Skip to content

Invalid accessible label for menu list due to inert #9737

@ashleyryan

Description

@ashleyryan

Provide a general summary of the issue here

Our menu and listbox components are built using the useMenu and useListbox hooks inside of a Popover component. The list element in each gets an aria-labelledby pointing at the trigger element. However, once the popover is open, inert is applied to the page, and that trigger element is now no longer visible, resulting in the list element not having an accessible name.

You can reproduce this on the useMenu doc page by inspecting the MenuList element and looking at the Accessibility details of the element. Interestingly, it says the accessible name of the list is "▼", which is wrapped in an aria-hidden. If I remove the inert from the root element, dev tools correctly identifies the name of the list as "Actions".

Note: we have noticed that the list will be labelled correctly if the trigger element has an aria-label, but it doesn't get the button text as it's label without it.

Image

🤔 Expected Behavior?

The menu-list element is correctly labelled by the trigger element, in this case "Actions".

😯 Current Behavior

Elements in the popover are not correctly labelled by their trigger elements on the page due to the inert property.

💁 Possible Solution

I believe this may be related to the switch to using inert in 1.11/August 2025 release

#8372

🔦 Context

No response

🖥️ Steps to Reproduce

  • Go to the useMenu doc page: https://react-aria.adobe.com/Menu/useMenu#menuitem
  • Inspect the accessible label of the MenuList html element in devtools, notice that the name does NOT include "Actions"
  • Remove the "inert" from the div element directly below the body element. Notice how the accessible label now does include "Actions"

Version

We are on 1.14.0, but I can reproduce it on the old doc site on 1.15.0

What browsers are you seeing the problem on?

Chrome

If other, please specify.

No response

What operating system are you using?

OSX Tahoe

🧢 Your Company/Team

No response

🕷 Tracking Issue

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions