Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Button flickers when mouse is right at the top or bottom edge #519

Closed
dimitris-athanasiou opened this issue Mar 15, 2018 · 6 comments
Closed

Comments

@dimitris-athanasiou
Copy link

Using chrome I noticed that if I hover my mouse on the edge of the top or bottom of any EUI button the button start flickering: alternating between the hovered/non-hovered rendering.

An example would be the Filled button in https://elastic.github.io/eui/#/guidelines/buttons

@snide
Copy link
Contributor

snide commented Mar 15, 2018

This is due to the animation transform (where the button moves UP one pixel, then back down). I'm not sure it's something I can solve without removing the animation. Given the choice between people noticing a glitch if they keep their mouse in the same place on a 1px hitbox and having no animation, I think I'm OK with sticking with the animation.

I see this happening on other big sites (here's Stripe.com) who use the same technique.

@snide snide added style only and removed bug labels Mar 15, 2018
@cchaos
Copy link
Contributor

cchaos commented Mar 15, 2018

The only way I can think of to get around this is to add another containing element to the EuiButton that handles the styling instead of applying it to the outermost (clickable) element. That way when you transform that second layer it doesn't affect the hit area of the clickable element.

I.E:

.euiButton {
  cursor: pointer; /* just handles the click events */

  > .euiButton-styles {
    background-color: blue;  /* this layer gets all the styling associated with the button */
    transform: translate(0,0); /* as well as the transforms */
  }
}

@cchaos
Copy link
Contributor

cchaos commented Mar 16, 2018

@snide
Copy link
Contributor

snide commented Mar 16, 2018

@cchaos Only negative I can see with that type of solution is that it makes the pure CSS harder to use. But we already have the content stuff in there, so it's really no worse than it already is. I'm OK with it if you are.

@cchaos
Copy link
Contributor

cchaos commented Mar 16, 2018

Yeah I was really more just testing my own theory. I'm on the fence about implementing it since it is a big change to the button styling for a very edge case.

@snide
Copy link
Contributor

snide commented Mar 30, 2018

Closing this issue as part of my weekly sweep. Think this one is small enough we can trade the minor aggravation for ease of use.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants