A Modal component built on <dialog> and its showModal method behaved in a way its author didn't expect: while testing, focus could be tabbed out of the dialog — still in modal mode — and onto the address bar. That contradicts the long-standing accessibility guidance to trap focus inside a modal.

According to discussion in a WHATWG HTML GitHub issue, that guidance is now considered obsolete for <dialog>. There is no need to trap focus — even in modal mode — when using the native element.

Here is the argument for that position, drawn from the people involved in the discussion.

What WCAG Actually Requires

Scott O'Hara lays out the history behind the focus-trapping advice. WCAG does not normatively state that focus must be trapped within a dialog; the normative spec says nothing at all about focus behavior inside a dialog. The informative 2.4.3 focus order understanding document does mention limiting focus behavior within a dialog, but in the context of a scripted custom dialog.

That document, together with the ARIA Authoring Practices Guide modal dialog pattern, predates broad availability of inert and <dialog>. The APG's remit is to demonstrate ARIA usage, and without native HTML features, trapping focus inside the custom dialog is much easier than replicating what <dialog> does. The only alternative would have been to tell developers to give every focusable element outside the modal a tabindex=-1.

Why Reaching the Browser Chrome Is a Feature

Léonie Watson makes the case for letting screen-reader users move focus to the address bar. In a page context, a user can already Tab out of the bottom and around the browser chrome, jump straight to the address bar with a keyboard command, open a menu, or close the tab — choices about how and why to escape a context. She argues it is logical for the same options to be available in a dialog context rather than a page context.

The W3C Accessible Platform Architectures (APA) Working Group, as reported by Matatk, reached a matching conclusion across several meetings: the native dialog element's current behavior should stay as it is, allowing tabbing from the dialog to browser functionality. The group highlighted the benefit for keyboard users who want to open a new tab to look something up or change a browser setting. The address bar also gives an additional natural escape route in situations such as kiosks, where the usual keyboard shortcuts aren't available.

The Practical Takeaway

If a component correctly uses the Dialog API's showModal method, focus trapping is not something to worry about.