-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Description
What is the issue with the HTML Standard?
Is a <dialog> focusable?
Codepen: https://codepen.io/jpzwarte/pen/oNRKWGz
Both Chromium and Firefox seem to think so: click inside the dialog and you can see the :focus style being applied. Safari on the other hand doesn't focus the dialog.
However, once you've focused the dialog and press TAB to focus the next element and then shift-TAB to go back, different things happen:
- Chromium skips the dialog
- Firefox focuses the dialog
So using the keyboard, you can never refocus the dialog in Chromium.
MDN is also not consistent:
"Do not add the tabindex property to the element as it is not interactive and does not receive focus." https://developer.mozilla.org/en-US/docs/Web/HTML/Element/dialog#usage_notes
"particularly for instances where a dialog's content is dynamically rendered when invoked, the element itself may provide the best initial focus placement." https://developer.mozilla.org/en-US/docs/Web/HTML/Element/dialog#accessibility
So which browser has it right? My guess is Firefox?