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

Hover bug: If you mouse in and out of element quickly hover appears but then doesn't go away #11

Closed
paulwehner opened this issue May 1, 2015 · 4 comments

Comments

@paulwehner
Copy link

As said in the title, if you enter and then leave a component quickly the hover background will come up but then not go away. So only the 'handleMouseEnter' event will fire, and not the 'handleMouseLeave'. To trigger the 'handleMouseLeave' you have to mouse back over the component slowly and then mouse out. I've noticed the same thing if you do a handleMouseDown and handleMouseUp, and then do a fast click. Only the first event will register, and the mouseUp event won't be registered.

@qimingweng
Copy link

I think hovering will continue to be a hard problem for inline styles. I like how JSS solves it, which is through classnames. Since JSXStyle also can export to classnames, maybe there can be a declarative way of adding hover/active styles this way too? Not sure what the API would look like though.

@petehunt
Copy link
Collaborator

Do you have a repro for this? I've seen it sporadically drop mouseEnter and mouseLeave events

@qimingweng
Copy link

One way I've achieved it in the past is if I hover over the element, use command tab to switch to a different app, then switch back and have the cursor already outside of the element.

@petehunt
Copy link
Collaborator

I fixed this at Smyte using this component: https://gist.github.com/petehunt/c2a1aa6bb30cb4699bd8

If there is significant interest I'd probably be OK moving this and its corresponding ClickRegion component into jsxstyle, or we could see if @spicyj would want a new EnterLeaveEventPlugin that uses hit testing.

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

No branches or pull requests

4 participants