How to keep focus within modal dialog?

Edit February 1, 2024: The inert attribute is now fully stable and can be used to prevent a user escaping a modal by making everything outside the modal inert. Additionally, you can use the dialog element with the showModal function to handle modal dialog focus automatically. Using showModal will open the dialog element as a … Read more

Making a clickable accessible through tab structure?

I note the question is tagged WCAG and “accessibility”. The answer to your question is therefore “don’t do that.” The other answers on this page will all work fine, for everyone except the people who need it to work, i.e. those using screenreaders or other assistive technology. None of the javascript-based solutions here are WCAG … Read more