[modal] Fix aria-hidden should not apply on non-portal modals - #49026
[modal] Fix aria-hidden should not apply on non-portal modals#49026ZeeshanTamboli wants to merge 17 commits into
Conversation
Deploy previewBundle size
Check out the code infra dashboard for more information about this PR. |
|
Codex found these issues. Could you look further into them? The first one seems relevant to me, when you use it like this: [P1] disablePortal still uses an unrelated container for accessibility masking [P1] Removing a lower nested modal can hide the surviving top modal [P2] The ancestor walk fails across Shadow DOM boundaries [P2] This narrows a public API from Element to HTMLElement |
|
Fixes #19450
Closes #43318 (Old PR)
Closes #48889 (Another PR attempt but does not handle this case)
Do not apply
aria-hiddenon non-portal modals (i.e whendisablePortal) ancestor. This hides the modals from the accessibility tree. Also, mark the siblings of modal asaria-hiddenso that they are inaccessible when the modal is opened. Handles cases with nested modals as well.Test the reproductions on Mozilla Firefox because Blink (rendering engine used by Google Chrome etc) blocks the aria-hidden on elements whose descendents have focus by default. So, it's reproducible in Firefox but a general issue on all browsers. Use a screen-reader and test it out. Check modal sibling elements in DOM as well where it should have
aria-hiddenattribute.Before: https://stackblitz.com/edit/github-fennfewl?file=src%2FApp.tsx
After fix: https://stackblitz.com/edit/github-fennfewl-pzeg3cck