There are various ways to hide content in web interfaces, but are you aware of the different effects they have on the accessibility of that content? While some might think it’s strange to have multiple different ways to hide content, there are certain benefits that each method provides.
There have been many articles written about hiding content, and this post will cover some of the noted methods, and purposefully ignore others. This article will highlight the methods of hiding content that are most appropriate for modern web development, and note the accessibility impacts of each.
To wrap this all up…
Let’s do a quick recap:
- There are three categories of hidden content:
- Completely Hidden.
- Visually Hidden.
- Only Hidden from Assistive Technology.
- Depending on the type of content, you will need to use an appropriate technique to hide it, via:
- Using CSS or [hidden] to hide content completely.
- Using visually-hidden / sr-only classes to visually hide content, but keep it available for assistive technologies.
- Or using aria-hidden=”true” to hide content specifically from screen readers.
Going back to my initial question “why are we hiding content?”, it’s apparent that there are some elements of a UI that truly need to be hidden. And while we have techniques to hide content, but still make it accessible for assistive technology users, I wouldn’t necessarily jump to these techniques as design solutions.
The goal should be to craft interfaces and experiences that are accessible and understandable to as many people as possible. Not to create interfaces where we can shoe horn in additional context by visually hiding it by default.