Skip to content

[Modal] aria-hidden should not be applied on non-portal modals #19450

Description

@pnarielwala-tc

aria-hidden=true gets applied on top level container when a modal is opened. But if disablePortal is used, aria-hidden should not be set on that top level container as the modal will be created inline and most likely within that top level container

Running axe on the opened modal yields the following error:

"ARIA hidden element must not contain focusable elements (aria-hidden-focus)"

Fix all of the following:
Focusable content should have tabindex='-1' or be removed from the DOM

You can find more information on this issue here:
https://dequeuniversity.com/rules/axe/3.3/aria-hidden-focus?application=axeAPI

https://www.w3.org/TR/wai-aria-practices/examples/dialog-modal/dialog.html

The dialog element is not a descendant of any element that has aria-hidden set to true.

  • The issue is present in the latest release.
  • I have searched the issues of this repository and believe that this is not a duplicate.

Current Behavior 😯

  1. Modal with disablePortal prop is opened and aria-hidden is set to true on top level html node

Expected Behavior 🤔

  1. Modal with disablePortal prop is opened and aria-hidden is not set to true on top level html node
  2. Modal without disablePortal prop is opened and aria-hidden is set to true on top level html node

Steps to Reproduce 🕹

https://codesandbox.io/s/material-mui-demo-9oddt?fontsize=14&hidenavigation=1&theme=dark

Context 🔦

Your Environment 🌎

Tech Version
Material-UI v4.9.0
React v16.12.0
Browser
TypeScript v3.8.0-dev.20200125
etc.

Metadata

Metadata

Labels

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions