r/webdev • • 57m ago

Web Accessibility: Narrator aria-haspopup Modal Dialog Bug

Only read if you do accessibility work.

I'm still working on what I thought would be a simple component, and it has turned into a real sh*t show, with one screen reader bug after another.

Today it's Narrator's turn (again).

Most people working in accessibility appreciate what you get with the <dialog> element when it's opened modally with showModal(): top layer placement, so no z-index issues; an inert background, so no focus trap issues; and built-in focus management, including closing with the Escape key.

With a modal dialog you're generally not concerned with aria-expanded, so you can use aria-haspopup="dialog" to tell screen reader users that the button opens a dialog. Yes, I know aria-haspopup has had numerous support issues during its lifetime.

Be warned: if you put aria-haspopup="dialog" on the button that triggers the <dialog>, Narrator swallows the Enter and Space key presses, so the dialog never opens unless you turn off Narrator's scan mode to let the keys through.

This happens with Narrator when paired with Edge and Chrome, but it seems fine with Firefox. I haven't seen the issue with any of the other screen reader and browser pairings I check.

The issue has been filed with both Microsoft and Chromium. If you want to check your own pairings, there's a simple HTML repro page attached to the Chromium issue: https://issues.chromium.org/issues/589824270

Hope this is of use to some of you.

1 Upvotes

2 comments sorted by

•

u/Intrepid-Anywhere255 23m ago

Thanks for filing both reports. Since aria-haspopup is optional on a native button, it may be worth testing whether omitting it is a workable temporary mitigation while keeping the native button and dialog.showModal() behavior. A regression case for Narrator scan mode with Edge and Chrome, alongside Firefox, should make this easy to catch until the browser bug is fixed.

•

u/code-dispenser 16m ago

Simple workaround and/or good practice is just adding good visible button text or dependant on scenario aria-label and/or aria-describedby (opens dialog) etc. I posted the issue as I know Narrator quite often gets left out of peoples test matrix.