feat(web): enforce keyboard focus trapping in custom modals(closes #2090)#2144
Conversation
|
🎉 Congratulations @shauryavardhan1307! Your Pull Request "feat(web): enforce keyboard focus trapping in custom modals(closes #2090)" has been successfully merged by @dipexplorer. Thank you for your valuable contribution to SahiDawa! 🇮🇳 Follow us on LinkedIn: https://www.linkedin.com/company/ratloopz/ to get shoutout |
|
👋 Your PR is approved for a LinkedIn shoutout! Follow our page to ensure you get properly tagged: https://www.linkedin.com/company/ratloopz/ |
🛑 STOP: Assignment & File Scope Check
Warning
PRs with unrelated files will not be reviewed and may be closed.
📋 PR Summary & Link
ExpiryModalandExportModal) to meet WCAG accessibility standards for dialogs. Added a reusable custom React hookuseFocusTrapto handle focus cycle and restoration without external package dependencies.📸 Proof of Work (Screenshots / Logs)
Important
No Pull Request will be merged without proof of testing!
Note: This is an accessibility behavior change for keyboard navigation (focus trapping/restoration) with no visual UI style changes. Programmatic verification logs are attached below:
Unit Test Execution Logs
PASS tests/useFocusTrap.test.tsx useFocusTrap √ automatically focuses the first focusable element inside the ref container on mount when enabled (50 ms) √ traps Tab key so that pressing Tab on the last element wraps focus back to the first (13 ms) √ traps Shift+Tab key so that pressing Shift+Tab on the first element wraps focus to the last (7 ms) √ restores focus to the previously focused element when unmounted (6 ms) Test Suites: 1 passed, 1 total Tests: 4 passed, 4 total Snapshots: 0 total Time: 1.562 s Ran all test suites matching tests/useFocusTrap.test.tsx.🏷️ PR Type
type: bugtype: featuretype: docstype: testingtype: securitytype: performancetype: designtype: refactortype: devopstype: accessibility✅ Checklist
Closes #2090)mainand resolved any conflicts