Skip to content

Consolidate duplicate visually-hidden aliases (.sr-only / .visually-hidden) #123

Description

@jackgranatowski

Problem

core/accessibility.css currently exposes two class names for the identical visually-hidden pattern:

.sr-only,
.visually-hidden,
.sr-only-focusable:not(:focus, :focus-within) { … }

Both selectors share one declaration block and produce exactly the same result. Having two names for one concept:

  • Invites questions about which to use (and why)
  • Sets a precedent for further aliasing (e.g. .hidden-accessible, .a11y-hidden, …)
  • Bloats the public API surface without adding capability

Options

  1. Keep .visually-hidden only — the plain-English, self-documenting choice. Better for a clean, opinionated API.
  2. Keep .sr-only only — familiar to devs coming from Bootstrap; lower migration friction.
  3. Keep both, document the canonical name — explicitly call one the canonical and the other a deprecated alias, with a removal milestone.

Recommendation

Adopt .visually-hidden as the single canonical name. If Bootstrap compatibility matters, document .sr-only as a deprecated alias and remove it in the next major version.

Affected file

core/accessibility.css — lines 129–142

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions