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

Space keydown event issue on Windows Firefox #9678

Closed
yxngl opened this Issue Mar 11, 2019 · 3 comments

Comments

Projects
None yet
2 participants
@yxngl
Copy link

yxngl commented Mar 11, 2019

Version

2.6.8

Reproduction link

https://codepen.io/yxngl/pen/VRzoMJ?editors=1011#0

Steps to reproduce

Tab to focus on the label and checkbox, then press space key.

What is expected?

Checkbox should be checked.

What is actually happening?

In Firefox developer edition on Windows, the check flashes and disappears. It works fine on Mac and Chrome and Edge.


Extracted from a UI library. Pressing Enter key always works. Looks like the input receive the space keydown event somehow? Not sure if it is only a browser quirk or the design should be improved. Thanks.

@posva

This comment has been minimized.

Copy link
Member

posva commented Mar 11, 2019

Cannot reproduce on Firefox on Mac. It may be due to the order of events (inherent to browsers) causing the checkbox to be checked twice in a very small gap of time, going back to initial state, does it also happen with other keys, like a?

@yxngl

This comment has been minimized.

Copy link
Author

yxngl commented Mar 11, 2019

Yeah, it works in Firefox on Mac. I think it is only for space key. The demo also binds the enter key. It works and I have just tried others. I thought it may be related to that native checkbox can be checked with space.

@posva

This comment has been minimized.

Copy link
Member

posva commented Mar 11, 2019

I managed to test now on Firefox. This is indeed related to the order that differs between browsers. As space also triggers selecting the checkbox so it ends up selected twice. This is something you should avoid in general because of the reason mentioned aboved

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.