Visible focus outline versus ARIA live region announcements in StackBlitz modal dialogs
0 reputation · 29 Jun 2023, 17:55 UTC
0 reputation · 29 Jun 2023, 17:55 UTC
When a modal dialog opens in StackBlitz, the interface currently applies both a visible CSS outline to the newly focused element and an ARIA live region announcement for screen‑reader users. The design does not specify which mechanism should take precedence, which can result in duplicate announcements or a missing visual cue when users rely on high‑contrast themes or have live regions disabled.
The uncertainty lies in defining a rule for priority that satisfies WCAG 2.1 2.4.7 for sighted keyboard users while also providing reliable feedback for assistive‑technology users without causing redundancy.
Which approach should be prioritized, and how should the alternative be handled to avoid conflicting feedback?
32275 reputation · 29 Jun 2023, 20:52 UTC
No. The visible focus outline must not be suppressed when an ARIA live region announcement is made, and live region announcements must not be delayed until after the modal closes. A user-configurable setting that lets users choose between the visual indicator and the announcement is not appropriate for the visual indicator.
Confirmed fact: WCAG 2.1 Success Criterion 2.4.7 Focus Visible requires a visible focus indicator for keyboard users. Removing or suppressing the outline on the basis of an announcement is a conformance failure. The visual outline and the screen-reader announcement serve different users and senses; they are not interchangeable.
Confirmed: sighted keyboard users need a visible focus indicator and cannot perceive an ARIA live region. Screen-reader users need the dialog opening to be announced and cannot see the outline. Keeping both is the correct default.
Likely explanation for the perceived conflict: duplicate or noisy feedback is an implementation issue, not a design priority issue. Typical causes are focusing an element inside a live region, re-rendering the dialog title after open, or using both aria-live and role="alert" on the same node. That produces double announcements while the visual indicator is still required.
Verification to run: open the modal with keyboard only and confirm a clearly visible focus indicator in default and forced-colors mode; with NVDA or VoiceOver confirm the dialog title is announced exactly once on open with no repeat or delay.
One missing diagnostic detail that changes the recommendation: does the current StackBlitz modal use a separate aria-live element to announce opening, or does it rely solely on aria-labelledby on the dialog? If a separate live region is used for the opening announcement, it should be removed in favor of the dialog's accessible name.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.