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

[useSelect] Selecting item with spacebar in firefox reopens the menu #1197

Open
lyml opened this issue Nov 18, 2020 · 5 comments
Open

[useSelect] Selecting item with spacebar in firefox reopens the menu #1197

lyml opened this issue Nov 18, 2020 · 5 comments

Comments

@lyml
Copy link

lyml commented Nov 18, 2020

  • downshift version: 6.0.6
  • firefox version: 82.0.3

Relevant code or config

Error present in reference implementation: https://www.downshift-js.com/use-select

What you did:

With firefox, open a menu and select an item with the spacebar key

What happened:

The item was selected, but the menu was reopened. Closely inspecting the result of onStateChange it is revelead that on key down the __menu_keydown_space_button__ is emitted, and on key up the __togglebutton_click__ is emitted.

Error is not present in chrome.

Reproduction repository:

Problem description:

Suggested solution:

@silviuaavram
Copy link
Collaborator

Indeed it happens on Firefox. Can someone investigate?

Thanks for reporting the issue!

@rtt63
Copy link

rtt63 commented Nov 28, 2020

Actually, this can be reproduced with Chrome by holding space pressed a little longer. However, on Firefox __togglebutton_click__ fires immediately

@silviuaavram
Copy link
Collaborator

If you can dig into this and even better provide a fix it would be super awesome! Thanks!

@lyml
Copy link
Author

lyml commented Dec 7, 2020

I'm not familiar with the downshift codebase but I can take a closer look sometime during the holidays.

@peterjcaulfield
Copy link

peterjcaulfield commented Mar 26, 2021

Looks this could be related to this FF bug:

https://bugzilla.mozilla.org/show_bug.cgi?id=1552419

as this prevent default doesn't seem to prevent an onClick event firing for the spacebar onKeyUp.

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