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."
The <dialog> element's showModal can still allow keyboard focus to escape the dialog (for example, to the browser address bar). Native dialog and inert behavior reduce the need for manual focus-trapping when those features are available. WCAG does not normatively require trapping focus within dialogs; earlier informative guidance addressed scripted custom dialogs before inert and <dialog> existed. The APG demonstrated ARIA patterns that recommended trapping focus when native features were not available. An alternative to trapping focus is removing outside elements from the tab order (for example by applying tabindex=-1).
Read at CSS-Tricks
Unable to calculate read time
[
|
]