kobaltedev / kobalte

A UI toolkit for building accessible web apps and design systems with SolidJS.
https://kobalte.dev
MIT License
1.2k stars 61 forks source link

Menubar: Incorrect trigger expanded on keyboard navigation #332

Closed fnky closed 5 months ago

fnky commented 6 months ago

Describe the bug

Tabbing into a menubar will focus the latest expanded trigger. When the trigger is focused, but not expanded, then navigating with keyboard will highlight the other triggers; but using keyboard to expand the item (Enter/Space/Arrow down) will only expand the focused trigger.

To Reproduce Steps to reproduce the behavior:

  1. On initial page load, tab into menubar trigger
  2. Use keyboard (e.g. left/right) to highlight another trigger
  3. Trigger the button with keyboard (Enter/Space/Arrow down) to try and expand the highlighted trigger.
  4. It expands the focused trigger, even if it isn't the current highlighted one.

Expected behavior

It should expand the highlighted item, rather than what was initially focused.

Screenshots

Desktop (please complete the following information):

Additional context See Radix UI Menubar as an example of expected behavior.

jer3m01 commented 6 months ago

Thanks for the excellent bug report!