question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

bug: hover styling activates when it shouldn't on some Android devices

See original GitHub issue

Bug Report

Ionic version: [x] 4.5.0

Current behavior: After clicking button hover background doesn’t disappear, it disappears only when you click away

Expected behavior: When you click button background should appear and disappear

Steps to reproduce:

  1. checkout https://github.com/JustasKuizinas/ionic-blank
  2. npm i
  3. ionic server
  4. open app in mobile device
  5. click one of the grey icons on the top right and button hover won’t disappear

Related code: https://github.com/JustasKuizinas/ionic-blank

Other information: I think it happens because of this(https://github.com/ionic-team/ionic/blob/master/core/src/components/button/button.scss):

@media (any-hover: hover) {
  :host(:hover) .button-native {
    background: var(--background-hover);
    color: var(--color-hover);
  }

I think this bug was introduced here in this commit https://github.com/ionic-team/ionic/commit/5c5934bc24bde387fe66e16f88158d992c71dcc9#diff-7c58c82ca091ee01c6244994d0362292

Also, I think it’s bad practise to use :hover pseudo selector on mobile devices, because on mobile devices :hover works a bit different than on desktop.

Ionic info:

Ionic:

   Ionic CLI                     : 5.0.2 (C:\Users\Justas\AppData\Roaming\npm\node_modu
les\ionic)
   Ionic Framework               : @ionic/angular 4.5.0
   @angular-devkit/build-angular : 0.13.9
   @angular-devkit/schematics    : 7.3.9
   @angular/cli                  : 7.3.9
   @ionic/angular-toolkit        : 1.5.1

Cordova:

   Cordova CLI       : 8.1.2 (cordova-lib@8.1.1)
   Cordova Platforms : android 7.1.4
   Cordova Plugins   : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webvie
w 4.1.0, (and 5 other plugins)

Utility:

   cordova-res : 0.3.0
   native-run  : 0.2.5

System:

   NodeJS : v10.15.3 (C:\Program Files\nodejs\node.exe)
   npm    : 6.9.0
   OS     : Windows 10

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:2
  • Comments:13 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
evangunawancommented, Aug 21, 2019

actually i solved it by changing the hover property to transparent. I don’t know if this the best way or not, but at least it works for me. Try to add this in your page scss: ion-button { --background-hover:transparent !important; }

2reactions
haroon407commented, Jun 28, 2021

I am having the same issue, any idea when can this be fixed as adding css classes seems like a workaround rather than a good solution

Read more comments on GitHub >

github_iconTop Results From Across the Web

bug: hover styling activates when it shouldn't on some Android ...
Bug Report Ionic version: [x] 4.5.0 Current behavior: After clicking button hover background doesn't disappear, it disappears only when you ...
Read more >
How to remove/ignore :hover css style on touch devices
I've used try/catch just in case some odd error shows up, that could crash the script, like deleteRule not working because of same-origin...
Read more >
Change the Hover state in Chrome for Touch Devices
By applying this state after a touch, a developer has to expect any hover styles to stick on mobile. This means adding styles...
Read more >
Dealing with hover on mobile - YouTube
We can't hover on mobile devices, so what can we do about hover animations and other things that we might need to have...
Read more >
How to prevent sticky hover effects for buttons on touch devices
On touch devices, there is no hover effect, therefore the button stays in its original state. Without the Use of JavaScript: CSS's media...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found