Accessibility · Middle · Question 32 of 75
Why render a custom modal in a React portal?
- 1Portals automatically add focus trapping and Esc handling
- 2It escapes parent stacking and makes the background easy to
inert - 3Portals make screen readers announce the modal immediately
Show the answer
Correct answer: It escapes parent stacking and makes the background easy to inert
Explanation
Portals only change where the DOM goes. You still have to manage focus, Esc and semantics. Note that React events bubble through the React tree.