Skip to content

Tweak language around modal dialogs #4381

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Aug 5, 2025
Merged

Tweak language around modal dialogs #4381

merged 11 commits into from
Aug 5, 2025

Conversation

patrickhlauke
Copy link
Member

Closes #4185

Note that this only softens/expands some of the example language in the understanding documents. The original issue #4185 seems to conflate non-normative examples in a non-normative document with requirements of how modal dialogs should be implemented ... they are not. They provide examples of appropriate focus order and absence of keyboard traps. They are not the only ways in which focus order or absence of keyboard traps can be achieved. Examples are non-exhaustive, and there is no need - in my view - to expand these further to specifically address variations that result from different behaviours related to <dialog>

Copy link

netlify bot commented May 5, 2025

Deploy Preview for wcag2 ready!

Name Link
🔨 Latest commit a08d776
🔍 Latest deploy log https://app.netlify.com/projects/wcag2/deploys/68921e2350543c00088a3789
😎 Deploy Preview https://deploy-preview-4381--wcag2.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@mbgower
Copy link
Contributor

mbgower commented May 23, 2025

someone misconstruing an example with a normative edict shouldn't necessarily lead us to made the examples less clear or confusing (which I personally find these to be). I'd prefer to leave as is, or lessen the change.

@mbgower As I understand it, the extension of the text is meant to prevent people from failing modal dialogs where the focus ring includes the browser chrome (e.g. the URL field) which does not seem problematic. Is that the only point where you feel it gets confusing?

Copy link
Member

@adampage adampage left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Heya, @patrickhlauke / @mbgower, how about these tweaks?

patrickhlauke and others added 4 commits July 3, 2025 23:48
Co-authored-by: Adam Page <adam@adampage.net>
Co-authored-by: Adam Page <adam@adampage.net>
Co-authored-by: Adam Page <adam@adampage.net>
Copy link
Contributor

@fstrr fstrr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the Focus Order update, I would prefer the text about being able to cycle through the user agent controls be reinstated, alongside the edit, so that it's clear that that behavior is okay.

@patrickhlauke
Copy link
Member Author

patrickhlauke commented Jul 4, 2025

@fstrr should we split the difference and maybe add a parenthetical somehow that reintroduces this? a la

all web page content outside the dialog becomes inert and cannot receive focus
(though, depending on implementation, the focus cycle might still include user agent controls)

@patrickhlauke
Copy link
Member Author

@fstrr should we split the difference and maybe add a parenthetical somehow that reintroduces this? a la

all web page content outside the dialog becomes inert and cannot receive focus
(though, depending on implementation, the focus cycle might still include user agent controls)

as discussed in today's WCAG 2.x backlog call, I've made that change @fstrr

@patrickhlauke patrickhlauke requested a review from fstrr July 11, 2025 16:24
a dialog opens and focus is set within the dialog. As
long as the dialog is open, focus is limited to the elements of the dialog. When the
long as the dialog is open, all web page content outside the dialog becomes
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this section say something slightly different to the APG modal dialogs pattern keyboard interaction section?

My personal view is that the APG needs to be changed to avoid focus being locked into the modal.

Copy link
Member Author

@patrickhlauke patrickhlauke Jul 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

APG is only a best practice suggestion, one way to implement a modal, and generally what the keyboard behaviour would be. it's not binding, and the revised wording here takes account of the fact that there are other valid implementations - like a <dialog> element - where browser UI will also still be within the focus order.

otherwise, this may suggest that native <dialog> fails WCAG

Copy link
Member

@adampage adampage Aug 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’ve heard anecdotally that one of the reasons the WHATWG chose not to trap focus in the <dialog> element is because that behavior has been used maliciously to extract sensitive information from vulnerable users.

Because of that, I’ve been tempted to submit a PR to APG updating its ARIA dialog implementation to follow suit. There’s an open (but 3 years stale) discussion about this here: w3c/aria-practices#1772. I’ve looked around for a paper trail on that WHATWG decision but haven’t been able to find anything.

tabbing from the last control in the dialog takes focus to the first control in the
dialog. The dialog is dismissed by activating the Cancel button or the OK button.</dd>
Cancel and OK. When the dialog has been opened, all web page content outside the dialog becomes
inert and cannot receive focus (though, depending on implementation, the focus cycle
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same issue as above

@mbgower
Copy link
Contributor

mbgower commented Aug 5, 2025

@adampage please take this up with the APG #4381 (comment)

@mbgower mbgower merged commit d5fdd10 into main Aug 5, 2025
6 checks passed
@mbgower mbgower deleted the patrickhlauke-issue4185 branch August 5, 2025 15:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SC 2.1.2 Tab looping
7 participants