ariakit / ariakit

Toolkit for building accessible web apps with React
https://ariakit.org
MIT License
7.84k stars 370 forks source link

Firefox automatically select first menu item on Space for opening menu #814

Closed h4m3d closed 1 year ago

h4m3d commented 3 years ago

šŸ› Bug report

Current behavior

Firefox automatically select first menu item on Space for opening menu. it actually occurs when we release Space.

Steps to reproduce the bug

with Firefox go to menu action example https://reakit.io/docs/menu/#menu-actions

  1. put focus on the Menu
  2. press space on the menu button
  3. on release of space it automatically select first menu item so it closes the menu

Expected behavior

like chrome it must just open the menu and not select any item

Possible solutions

Environment

Please, run the command below inside your project directory.

$ npx envinfo --system --binaries --browsers --npmPackages "{react*,reakit*}"

  System:
    OS: Linux 5.9 Arch Linux
    CPU: (4) x64 Intel(R) Core(TM) i5-3210M CPU @ 2.50GHz
    Memory: 7.88 GB / 11.13 GB
    Container: Yes
    Shell: 5.1.4 - /bin/bash
  Binaries:
    Node: 15.5.0 - /usr/bin/node
    npm: 6.14.10 - /usr/bin/npm
  Browsers:
    Firefox: 84.0.1
  npmPackages:
    react: ^17.0.1 => 17.0.1 
    react-dom: ^17.0.1 => 17.0.1 
    reakit: ^1.3.2 => 1.3.2
open-collective-bot[bot] commented 3 years ago

Hey @h4m3d :wave:,

Thank you for opening an issue. We'll get back to you as soon as we can. Please, consider supporting us on Open Collective. We give a special attention to issues opened by backers.

If you use Reakit at work, you can also ask your company to sponsor us :heart:.

diegohaz commented 3 years ago

Thanks for reporting it @h4m3d!

This actually also happens on Chrome, but you need to press Space for a little longer.

I haven't tested it yet, but my guess is that we should move this to the onKeyUp event: https://github.com/reakit/reakit/blob/bf3fdfdfa511f8f09edf8f5c55ed691a9b592ad8/packages/reakit/src/Menu/MenuButton.ts#L96

diegohaz commented 1 year ago

This should be fixed in the latest version of @ariakit/react.