DEV Community

Discussion on: A new (and easy) way to hide content accessibly

Collapse
 
dotnetcoreblog profile image
Jamie

I'm completely new to adding accessibility to my apps and sites - which I feel bad about, but then I know a lot of folks who don't bother which makes me feel better. So I hope you'll forgive my ignorance, why would you need to hide an element from a screen reader? I realise that's not the point of this article, but it's something that you mention towards the beginning (in the list of three reasons to hide content).

Collapse
 
elizabethschafer profile image
Elizabeth Schafer

Great question! I think this is generally pretty uncommon, but here's a couple of examples:

  • When you open a modal dialog, you can usually still see the page content visually behind it, but you'd want to hide that from screen reader users, so all they can interact with is the dialog.

  • I can't think of a good example, but sometimes you'll want to have duplicate content shown visually, but it makes more sense to hear it read back only once.

Collapse
 
dotnetcoreblog profile image
Jamie

The modal example makes perfect sense, and I got it right away.

I have a perfect example for the duplicated content: the Microsoft forums. It works a little like stack overflow, but is presented differently. The question is presented at the top of the page, immediately followed by the accepted answer, which is then followed by the discussion which lead to that answer. Often, the first post in the discussion is the answer.

It's not a great example, but it's an example that I thought of straight away.

Thread Thread
 
elizabethschafer profile image
Elizabeth Schafer • Edited

I thought of an example: sometimes websites will show a profile picture that's a link to a user profile, and also have text next to it with the user's name which also links to the same profile. Those two links would effectively be the same to screen reader users, so you'd want to hide one of them.