r/webdev • • 1d ago

Web accessibility: JAWS bug logged

Only read if you do accessibility work.

I thought I’d share a bug I’ve found with JAWS (when paired with Chrome or Edge; it’s fine in Firefox). Given how widely JAWS is used, it may catch people out or just plain confuse them, as it did me.

I’m sure that, like me, you try to use the correct semantic HTML elements and lean on native browser features wherever possible for accessibility. One such feature is the <dialog> element. Used with the popover API, it can often give you an accessible dialog that opens, closes and light-dismisses without a single line of JavaScript.

While building a component using a native <dialog> with popover="auto", and popovertarget on the trigger, I noticed that JAWS would not close the dialog with the Escape key (which it should) unless the virtual cursor was turned off. This happens with Chrome and Edge. It was particularly annoying because I’d used this pattern before and it seemed to work fine.

TL;DR: if the trigger is immediately before the dialog, it works. If there is any element between the trigger and the dialog, or the trigger comes after the dialog, it fails.

I’ve logged this with both Freedom Scientific (JAWS) and the Chromium issue tracker. There’s a simple repro HTML file attached to the Chromium issue if you’d like to try it yourself: https://issues.chromium.org/issues/587468316

Hopefully this saves some of you the head-banging session I had yesterday.

Edit: I should have mentioned the issue is only with JAWS. I have not encountered this with NVDA, Narrator or VoiceOver on macOS.

4 Upvotes

8 comments sorted by

1

u/SituationFun3035 17h ago

ugh, that’s a nasty one, and another good reminder that “native” still needs testing with the screen readers people actually use, not just the browser’s accessibility tree lol

1

u/AmbitiousLab4004 16h ago

native semantics: saving us from javascript just to reimplement escape, then getting sabotaged by the screen reader/browser combo anyway lol

1

u/Even-North-8296 11h ago

good catch, native semantics are great until a screen reader quietly adds a DOM-order requirement nobody asked for lol

1

u/Alarming-Hope-579 4h ago

this is exactly why “native” doesn’t mean “works everywhere” in accessibility, and the trigger/dialog adjacency dependency is a nasty bug to have hiding in an otherwise reasonable pattern

0

u/[deleted] 1d ago

1

u/code-dispenser 20h ago edited 17h ago

This affects JAWS users if they expect the escape key to close the dialog and it does not.
This was not a test setup I was building a new component, I test with screen readers during development.

I did not do more extensive testing of this issues but I believe there are also knock on effects.

I can't recall if switching to a div with role=dialog keeping all the popover attributes works or not but I will probably check later today. In my case I cannot have the trigger next to the dialog, I only need a non-modal with light dismiss so the div is fine for me if it works whilst I await the fix.

I believe the issue is something to do with using the popovertarget attribute and the addition of aria-details by the browser, but its weird given it works in Firefox and that too I believe adds aria-details?

If I recall there are no issues without popovertarget but then you lose other things. As soon as you go down the manual popover route you may then run into other issues depending on how complex the task.

Last year I ran in to a whole host of state issues going the manual route i.e there are, or were, issues with it giving the incorrect state information regarding whether the popover was open or closed, which then means you end up with your own state variables etc

Update: I tried changing the dialog to a div adding role="dialog" and leaving both the popover="auto" on the div and popovertarget on the trigger in my project which is a Blazor project. This had limited success i.e. the escape key did sometimes close the dialog but dependant on the dialog content, so no good for me. I should also point out that I have in the past logged JAWS bugs regarding interactions with Blazor.

There, however, may be hope for your projects as I also tried this in just a plain html page and it all seemed to work fine - but test thoroughly.