Merge "Disable hover style for buttons on mobile devices"
diff --git a/polygerrit-ui/app/elements/shared/gr-button/gr-button.html b/polygerrit-ui/app/elements/shared/gr-button/gr-button.html
index 7cac2d8..4e1ec4b 100644
--- a/polygerrit-ui/app/elements/shared/gr-button/gr-button.html
+++ b/polygerrit-ui/app/elements/shared/gr-button/gr-button.html
@@ -105,11 +105,28 @@
/* END: Copy from paper-button */
paper-button:hover {
background: linear-gradient(
- rgba(0, 0, 0, .12),
- rgba(0, 0, 0, .12)
+ rgba(0, 0, 0, .12),
+ rgba(0, 0, 0, .12)
), var(--background-color);
}
+ /* Some mobile browsers treat focused element as hovered element.
+ As a result, element remains hovered after click (has grey background in default theme).
+ Use @media (hover:none) to remove background if
+ user's primary input mechanism can't hover over elements.
+ See: https://developer.mozilla.org/en-US/docs/Web/CSS/@media/hover
+
+ Note 1: not all browsers support this media query
+ (see https://caniuse.com/#feat=css-media-interaction).
+ If browser doesn't support it, then the whole content of @media .. is ignored.
+ This is why the default behavior is placed outside of @media.
+ */
+ @media (hover:none) {
+ paper-button:hover {
+ background: transparent;
+ }
+ }
+
:host([primary]) {
--background-color: var(--primary-button-background-color);
--text-color: var(--primary-button-text-color);