DEV Community

Discussion on: Accessible Modal With Or Without JavaScript

 
madsstoumann profile image
Mads Stoumann

Again, thank you for your comprehensive answer!

To recap:

  1. The :target-based modal works just fine for non-screen-readers using only CSS and HTML.
  2. With JS enabled, it works fine for people like me, who cannot use a mouse.
  3. But for screen-readers, with inline links, the behaviour can be unexpected.

I need to know how screen-readers normally announce inline links, using fragment identifiers - I'll look into that.

Because, could it potentially be enough to set aria-hidden="true" on the modal by default, and change this to false on the hashchange-event?
And set the aria-label to "Back to previous loccation"?