QuizzesPortals, Modals and Overlays — Concept Check
intermediate
react

Portals, Modals and Overlays — Concept Check

Questions on Portals, Modals and Overlays. A portal renders a child into a different DOM node while keeping it in the React tree. It is how modals escape overflow and stacking contexts — and it is the easy half of building one.

7 minutes 7 questions Pass at 70%
Time Limit
7 minutes - timer starts when you begin
Change Answers Freely
Revisit and change any answer before submitting
Full Review After Submit
Correct answers and explanations shown for every question
Auto-submit on timeout
Quiz submits automatically when time runs out

Questions in this quiz

7 questions on Portals, Modals and Overlays — Concept Check. Work through them here, then start the quiz to answer them and see your score.

  1. 1.A modal rendered inside a card is clipped by the card's overflow. What is the solution?

    • AIncrease the z-index of the modal
    • BAdjust the card's overflow property
    • CUse a portal to render the modal in a different DOM node
    • DRender the modal as a sibling of the card
  2. 2.A developer notices that a modal does not close when the Escape key is pressed. What might be missing?

    • ACorrect z-index for the modal
    • Brole='dialog' attribute
    • CFocus trapping mechanism
    • DEvent listener for keydown on Escape
  3. 3.Why might a modal's content be inaccessible to screen readers even though it is visible?

    • AOverflow:hidden on the body
    • BLack of focus trapping
    • CMissing aria-modal attribute
    • DIncorrect z-index
  4. 4.A modal is rendered using a portal but events do not propagate to its React parent. What could be wrong?

    • AFocus is not trapped in the modal
    • BIncorrect DOM node for rendering the portal
    • CEvents are stopped by stopPropagation
    • DMissing role='dialog' attribute
  5. 5.A developer uses overflow:hidden to lock scroll on iOS, but the background still scrolls. Why?

    • AOverflow:hidden is not supported on iOS
    • BFocus is not trapped in the modal
    • CThe modal's z-index is too low
    • DiOS requires position:fixed for scroll locking
  6. 6.A modal does not return focus to the trigger element on close. What might be missing?

    • AOverflow:hidden on the body
    • BFocus restoration logic
    • Caria-modal attribute
    • DCorrect z-index
  7. 7.Which of the following is NOT a requirement for an accessible modal?

    • AOverflow:hidden on the body
    • BFocus trapping
    • Caria-modal attribute
    • DCorrect z-index