React
Avancé
Building an accessible modal with focus trapping

Type d'évaluation

Mise en situation réelle

Analyse

Intelligence Artificielle

Compétences ciblées

react
accessibility
modal
focus-trap
useref

Scénario Technique

Context A modal dialog component is used for critical confirmations, but keyboard navigation breaks when the modal opens — focus escapes to the background. The Problem The modal does not trap focus within itself, making it unusable for keyboard and screen reader users, failing WCAG 2.1 AA criteria. Constraints Use useRef and useEffect to trap Tab focus within the modal. Return focus to the trigger element on close. Handle the Escape key to close the modal. Expected Deliverable An accessible React modal component with focus trapping, Escape key handling, and focus restoration on close, compliant with WCAG keyboard navigation requirements.

Prêt à évaluer ce talent ?

Accédez à l'interface de test complète pour soumettre votre architecture ou votre code.

Commencer le Défis