Skip to content

Visually Hidden Text: Check Its Accessible Name

Compare visually hidden text, display none and a directly referenced label. Check the button’s computed name in Chrome.

Two ivory sleeves with a partially visible purple tab, a blank strip and an orange clip
Jack Lee
3 Min Read
Share
On This Page

You hide the text on a search button to keep the header compact. The icon still works, but the browser may expose an unnamed control. Check how you hide the label and how the button gets its name.

Check how the text is hidden

A visually hidden utility can clip text out of view while leaving it available for accessibility name computation. A normal child label with display: none or the hidden attribute is excluded when the button gets its name from its contents. A directly referenced hidden label is a separate case. The accessible name algorithm can use it through an explicit label reference.

Use a native button for an action and a native link for navigation. If the control is icon-only, also see our icon button check for reading the browser’s accessibility pane.

Compare four buttons in Chrome

SEOWithJack tested four local buttons in Chrome using the same text. Our utility clipped a one-pixel span, while the second and third examples hid their child text. The final button explicitly pointed at a hidden label.

Markup or CSSComputed button name
Visually clipped child textOpen course search
Child text with display: noneEmpty
Child text with hiddenEmpty
aria-labelledby directly references hidden labelOpen course search

This was a computed-name check in Chrome. No separate screen-reader session was run.

Check the actual component after styling it

  1. Inspect the button on the rendered page. In Chrome DevTools, open Accessibility and find the computed Name.
  2. If the name is empty, check whether the label is a child hidden by CSS or a separate element referenced by ID. An empty computed Name tells you where to start looking. Use visible wording if it fits the design. For a visually hidden label, use a text-only utility that preserves its accessibility.
  3. Repeat at the mobile breakpoint and tab to the button to confirm that its focus stays visible. Check the name again on both versions. If the element is a linked image rather than a button, see our image-link naming guide.

Frequently asked questions

What happens to a button label with display: none?

A child label is normally excluded from the regular name-from-content calculation. Inspect the actual button, because an explicit label can supply a name separately.

Can aria-labelledby refer to a hidden label?

Yes. When the attribute directly points to the hidden label, its text can be used for the name. Check that the ID resolves and that the name matches the action.

Should I clip the entire focusable button?

Keep the control and its keyboard focus visible. Apply the visually hidden utility to the explanatory text when the design needs a compact visible control.

Share This Article