There is No Need to Trap Focus on a Dialog Element | CSS-Tricks
Briefly

There is No Need to Trap Focus on a Dialog Element | CSS-Tricks
"WCAG is not normatively stating focus must be trapped within a dialog. Rather, the normative WCAG spec makes zero mention of requirements for focus behavior in a dialog. The informative 2.4.3 focus order understanding doc does talk about limiting focus behavior within a dialog - but again, this is in the context of a scripted custom dialog and was written long before inert or <dialog> were widely available. The purpose of the APG is to demonstrate how to use ARIA."
"And, without using native HTML features like <dialog> or inert, it is far easier to trap focus within the custom dialog than it is to achieve the behavior that the <dialog> element has. Both the APG modal dialog and the WCAG understanding doc were written long before the inert attribute or the <dialog> element were widely supported. And, the alternative to instructing developers to trap focus in the dialog"
Native <dialog> elements using showModal can allow keyboard focus to move out of the dialog (for example, to the browser address bar). The normative WCAG specification does not require focus to be trapped inside a dialog. Earlier guidance and the APG focused on trapping because they assumed scripted custom dialogs and predated widespread support for inert and <dialog>. With native dialog and inert available, manual focus-trapping becomes unnecessary. Developers should use native features, make background content inert or non-interactive, restore focus appropriately, and ensure accessible labeling and keyboard interaction for modals.
Read at CSS-Tricks
Unable to calculate read time
[
|
]