Skip to content

Unexpected ActionMenu focus handling #6434

@adierkens

Description

@adierkens

Description

When converting the tests for ActionMenu to vitest (#6383) an issue with the focus management of ActionMenu was discovered. The tests assert that, when opening the menu w/ a click, the button should remain focused and arrow-down should highlight the first item in the list.

However, in storybook (and vitest) the first item to be highlighted after opening the menu is the second item in the list. (see video)

CleanShot.2025-08-01.at.10.27.00.mp4

The menu works as expected when it is opened via the keyboard.

I suspect this is due to a the focus-lock management auto-advancing the focus into the menu prior to the arrow keys being clicked; thus when the arrow-key is pressed it advances to the second item in the list.

When fixing this, the tests skipped in #6435 should be re-enabled as well.

Steps to reproduce

  1. Go to the ActionMenu story in storybook
  2. Click on the Menu
  3. Click down-arrow
  4. Observe that the first highlighted item is the second in the list

Version

v37.30

Browser

Chrome

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions