Skip to content

MenuTrigger does not set isNonModal on PopoverContext, causing Popover to add role="dialog" around Menu #10002

@Ovgodd

Description

@Ovgodd

Provide a general summary of the issue here

When using the MenuTrigger > Popover > Menu pattern, the Popover overlay element receives role="dialog", which is incorrect for a menu popup. This happens because MenuTrigger does not pass isNonModal: true through PopoverContext, so Popover defaults to treating itself as a dialog.

This causes screen readers to announce "dialog" when opening a menu, which is confusing for users and does not match the expected semantics of the WAI-ARIA APG Menu Button pattern.

🤔 Expected Behavior?

When a Popover is used inside a MenuTrigger, the overlay element should not have role="dialog". The popup should only contain role="menu" semantics, as specified by the WAI-ARIA APG Menu and Menubar pattern.

A screen reader should announce something like:

"Actions, menu button, collapsed" > (click) > "Open, 1 of 5"

No "dialog" should be announced.

😯 Current Behavior

The Popover overlay element gets role="dialog" even when used insideMenuTrigger`.

A screen reader currently announces:

"Actions, button" > (click) > "dialog, dialog, Open, 1 of 5"

💁 Possible Solution

Maybe add isNonModal: true to the PopoverContext value provided by MenuTrigger.

🔦 Context

We are building an accessible UI kit for that must comply with RGAA (the French transposition of WCAG). An our dropdown menus for announcing "dialog" via screen readers.

We use the recommended MenuTrigger > Popover > Menu pattern from react-aria-components. Since there is no clean way to prevent role="dialog" without using isNonModal (which has a warning discouraging its use), we aim to work around this with a MutationObserver that removes the attribute from the DOM as soon as Popover sets it.

🖥️ Steps to Reproduce

Open a menu with the screen reader enable and sees "dialog" displayling and check the popover in the DOM

Image

Version

1.16.0

What browsers are you seeing the problem on?

Chrome

If other, please specify.

No response

What operating system are you using?

windows 11

🧢 Your Company/Team

No response

🕷 Tracking Issue

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions