Skip to content

Focusability of <dialog> itself #10454

@jpzwarte

Description

@jpzwarte

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions