Light mode
3 items shown.
- Apples
- Carrots
- Oats
Accessible names, visually hidden text, and concise status announcements.
Use .visually-hidden to keep supplemental text available to assistive technology while removing it from the visual layout. The library supplies CSS only; the examples below use local catalog behavior.
Light and dark examples are identical. Shaded explanations mirror the hidden text for visual review; these noninteractive teaching aids are excluded from the accessibility tree to avoid repeating that text.
Use a persistent, initially empty status region to report the result of a user action without moving focus. The visible list and count remain available to everyone.
The native category menu already announces its selected option. Our message adds only the result, such as “1 of 3 items shown.” The menu’s option names and keyboard instructions come from the browser and screen reader, separately from this message.
Choose one announcement source in an application: this catalog shows a hidden region for demonstration. If the visible result count already contains the complete message, give that visible element role="status" and omit the hidden duplicate. Use hidden status text when it adds a concise equivalent of information otherwise conveyed visually.
3 items shown.
No update yet. Choose a category.
3 items shown.
No update yet. Choose a category.
<p class="visually-hidden" role="status" aria-atomic="true"></p>
<!-- Application code updates this existing node after filtering. -->
The button visibly says “Edit”; its text includes the item name for assistive technology. Keeping the visible wording at the beginning also helps people refer to the control by its visible label.
Demo behavior: Edit only reports which item was chosen; it does not open an editor. That feedback region starts empty. In an application, implement the actual editing action and its focus behavior; do not copy this extra status announcement when the newly focused editor already communicates the change.
Edit Apples
Edit Oats
Only “Edit” is visible on each button. The item name is hidden inside it.
Edit Apples
Edit Oats
Only “Edit” is visible on each button. The item name is hidden inside it.
<button type="button">Edit<span class="visually-hidden"> Apples</span></button>
Hide only the label text inside the button. While the field has content, the clear button remains visible and keyboard accessible. This is an alternative to aria-label; existing close/clear buttons do not need to migrate just to use the utility.
The X is decorative. The hidden text names the button. Clear returns focus to the input, then hides the empty field’s clear button; typing brings it back.
The X is decorative. The hidden text names the button. Clear returns focus to the input, then hides the empty field’s clear button; typing brings it back.
<button type="button" data-barba-variant="icon" data-barba-shape="icon">
<svg aria-hidden="true" focusable="false" viewBox="0 0 24 24">…</svg>
<span class="visually-hidden">Clear item name</span>
</button>
These are implementation rules for this library’s examples, with links for the underlying accessibility requirements. The utility changes visual presentation only; it does not add naming, live announcements, focus management, or application behavior.
.visually-hidden for supplemental text or an equivalent of information already conveyed visually.hidden, display:none, visibility:hidden, aria-hidden="true", or inert to that text or its ancestors. The empty field’s clear button is intentionally hidden as a whole because its action is unavailable..skip-link for a skip link that becomes visible on focus. This utility never reveals itself. See Bootstrap’s distinction between hidden and focus-revealed helpers.role="status" aria-atomic="true" on an existing visible result message when it already says everything needed. Otherwise keep one persistent, initially empty hidden status region in the DOM before updates. Do not conditionally mount a populated region and assume it will be announced.role="alert" or aria-live="assertive" for ordinary filtering.Read W3C’s status-region technique and tests and which changes qualify as status messages. A focus change can already communicate a new context; it does not automatically need a second announcement.
button type="button" for an action, or a link with a real destination for navigation. For the Edit button, append the item’s name in a hidden span, including a separating space. Expected names here: “Edit Apples” and “Edit Oats”. Keep that context synchronized with the displayed item and translate the complete phrase appropriately.aria-label or aria-labelledby on top of these button contents: they can override the content-derived name. Hidden text alone does not label an unrelated input; retain its associated visible label.Read W3C’s label-in-name guidance and accessible naming techniques and precedence.
aria-label. Existing correctly named icon buttons need no migration. Mark the decorative SVG aria-hidden="true" focusable="false"; do not rely on its appearance or a tooltip as the button’s only name.input.value and explicitly dispatches an input event to synchronize the example. Assigning the value alone does not fire that event. Framework applications should use their normal state-update path.Read MDN’s icon-button naming guidance and how input events relate to programmatic changes.
After adopting the library release, replace only the duplicated sr-only and row-announcement hiding styles. Preserve semantics and application behavior, then review status-region mounting and duplicate announcements separately. A CSS replacement does not fix announcement timing.