[Code Demo] Focus Trapping in Modal System | JSer - Front-End Interview questions

preview_player
Показать описание
One problem of accessibility is Focus Trapping, in this code demo, we managed to handle 4 requirements below
1. when modal is opened, focus the first focusable element
2. TAB/SHIFT + TAB should be within the modal
3. ESC to close the modal
4. when closed, refocus the trigger

Hi I'm a JavaScript engineer who is not good at algorithms,
and currently practicing leetCode & BFE.dev. If you are interested, maybe we can learn together.
Рекомендации по теме