CSS Utilities Visually Hidden

Visually Hidden

Add the wa-visually-hidden class to any element to remove it from the page visually while keeping it available to screen readers and other assistive technologies. That's what you want for skip links, invisible labels on icon-only buttons, and any text that describes something a sighted user already understands from context.

"There are real world situations where visually hiding content may be appropriate, while the content should remain available to assistive technologies, such as screen readers. For instance, hiding a search field's label as a common magnifying glass icon is used in its stead." — The A11Y Project

Since visually hidden content can receive focus when tabbing, the element becomes visible again as soon as something inside it receives focus. That behavior is intentional: sighted keyboard users need to see where the focus indicator is.

Examples

Link to This Section Link to This Section

In this example, the link will open a new window. Screen readers will announce "opens in a new window" even though the text content isn't visible to sighted users.

Content Conveyed By Context

Link to This Section

Adding a label may seem redundant at times, but they're very helpful for unsighted users. Rather than omit them, you can provide context to unsighted users with visually hidden content that will be announced by assistive devices such as screen readers.

Visually Hidden Input Parts

Link to This Section

Sometimes you want a form control to have a cleaner, more minimal appearance by hiding the label or hint visually. However, removing these elements entirely would make the form inaccessible to users with assistive devices.

Instead, you can hide them visually while keeping them available to screen readers by adding the wa-visually-hidden-label or wa-visually-hidden-hint class.

Force Visually Hidden

Link to This Section

There are cases where you want to always visually hide certain content, even when it's focused. For example when hiding a checkbox to render a custom one:

    No results