Skip to content

USWDS-Site - Navigation: Remove redundant "navigation" from aria-labels - #3237

Open
AKnassa wants to merge 1 commit into
uswds:mainfrom
AKnassa:fix/nav-aria-label-redundancy-3059
Open

USWDS-Site - Navigation: Remove redundant "navigation" from aria-labels#3237
AKnassa wants to merge 1 commit into
uswds:mainfrom
AKnassa:fix/nav-aria-label-redundancy-3059

Conversation

@AKnassa

@AKnassa AKnassa commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Summary

Removed the redundant word "navigation" from aria-labels on the site's navigation landmarks so screen readers announce each landmark once instead of twice (e.g. "Primary navigation navigation").

Related issue

Closes #3059

Problem statement

Screen readers announce an element's navigation role after reading its label. Site templates labeled their <nav> landmarks with phrases ending in "navigation" ("Primary navigation", "Page navigation", "Next report internal navigation"), so users of screen readers heard the word twice on every page — the exact redundancy MDN's navigation role guidance says to avoid.

Solution

Stripped the trailing "navigation" from every site-owned navigation landmark, so what's announced is exactly what each label originally intended, once:

  • _includes/navbar.html — "Primary navigation" → "Primary" (the site-wide top nav)
  • _includes/next/next-prefooter.html — "Page navigation" → "Page"
  • _layouts/next-content.html and _next/01-summary.md — "Next report internal navigation" → "Next report internal"

Deliberately left unchanged, with reasons:

  • The two <aside> labels (_layouts/pattern.html, _layouts/styleguide.html) — asides announce as "complementary", not "navigation", so there's no redundancy there. The in-page-nav component also builds its own inner <nav> labeled from data-title-text, not the aside's label.
  • Component example previews (like the Footer preview flagged in the issue) render markup from the @uswds/uswds package — those labels are covered by USWDS - Bug: Remove "navigation" text from aria labels for navigation roles uswds#6301 and should be fixed there.

Also added spec/navigation_aria_label_spec.rb, which scans every site-owned .html and .md file for navigation landmarks whose aria-label still contains "navigation" — it caught the fourth offender in _next/01-summary.md during development and guards against the redundancy coming back.

Testing and review

  1. Run bundle exec rspec — 11 examples, 0 failures.
  2. Run bundle exec jekyll build — the built homepage renders aria-label="Primary" and the /next/ report pages render the shortened labels; no site-owned nav landmark retains the redundant word.
  3. With a screen reader or rotor on any page, the top nav now announces "Primary, navigation" instead of "Primary navigation navigation".

Screen readers announce the navigation role after the label, so
labels like "Primary navigation" were read as "Primary navigation
navigation". Strip the trailing word so each landmark is announced
once, as originally intended.

Add navigation_aria_label_spec to guard every site-owned template
and content file against reintroducing the redundancy.

Fixes uswds#3059
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Triage

Development

Successfully merging this pull request may close these issues.

USWDS-Site - Bug: Remove "navigation" text from aria labels for navigation roles

1 participant