jkup/learn-a11y

Add note about answers branch

jkup opened this issue · 1 comments

jkup commented

Add a note to the documentation about how to use the answers branch.

hello, when we open the modal as we click on the modal button, the active element in this case is the modal button itself so i think we need to add an keydown (Escape) event listener to this modal line to be able to close the modal if we press the escape button before we press tab to focus on the modal.

let previousFocusedElement = document.activeElement; previousFocusedElement.addEventListener("keydown", (event) => { if (event.keyCode === 27) close(); });