[Modal] aria-hidden should not be applied on non-portal modals
@ZeeshanTamboli is already working on this.
Since Aug 25, 2026.
Assessment
This issue has not been assessed yet.
Description
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 😯
- Modal with
disablePortalprop is opened andaria-hiddenis set to true on top level html node
Expected Behavior 🤔
- Modal with
disablePortalprop is opened andaria-hiddenis not set to true on top level html node - Modal without
disablePortalprop is opened andaria-hiddenis 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. |
- Dominant language
- JavaScript
- Stars
- 99.1k
- Forks
- 32.5k
- Avg merge
- 2d 17h
- Merged PRs (30d)
- 106
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from mui/material-ui
-
type: new feature waiting for 👍
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
mui/material-ui#48254 · 3 comments · 1 reaction ·
-
has workaround scope: avatar waiting for 👍
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
mui/material-ui#48190 · 5 comments ·
-
has workaround scope: typography type: new feature waiting for 👍
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
mui/material-ui#46488 · 2 comments · 1 reaction ·
-
has workaround scope: text field type: bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
mui/material-ui#37216 · 6 comments ·
-
docs scope: autocomplete
Difficulty 1/5 1-3 hours Newbie friendliness 68/100
mui/material-ui#35713 · 5 comments ·
Similar issues
-
code-quality refactoring
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
github/gh-aw-firewall#8816 ·
-
integration:quickjs org:external priority:backlog topic:code-interpreter topic:middleware type:feature
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
langchain-ai/deepagents#6450 ·
-
optimization optimization:agents-md-curator
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
githubnext/gh-aw-cao#13143 ·
-
status: needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100