Skip to content

fix(a11y): add aria-labelledby to section panels in built output - #14

Open
ashishbhateja wants to merge 1 commit into
mainfrom
fix/build-section-aria-labels
Open

ashishbhateja wants to merge 1 commit into
mainfrom
fix/build-section-aria-labels

Conversation

@ashishbhateja

Copy link
Copy Markdown
Owner

What

The page() function in scripts/build.mjs was missing aria-labelledby attributes on all four <section> elements, and the "Reading list" <h2> was also missing its id. Every built edition page therefore presented four unlabeled section landmarks to screen readers — they would be announced identically with no way to distinguish them.

The development reader (src/reader/reader.html) already has the correct markup. This change aligns the build output to match.

Why it matters

When a page contains multiple <section> elements, WCAG 2.1 §4.1.2 (Name, Role, Value) requires each landmark region to have an accessible name. Without aria-labelledby, a screen reader user navigating by landmarks hears "section … section … section … section" with no indication of which is which. Adding the labels restores the intended navigation structure.

Advances issue #5 (accessibility — WCAG 2.1 AA conformance).

Changes

  • scripts/build.mjs — four one-line edits to the page() template:

    • added aria-labelledby="arc-heading" to the arc section (which already had id="arc-section")
    • added aria-labelledby="interests-heading" to the interests section
    • added aria-labelledby="search-heading" to the search section
    • added aria-labelledby="recommendations-heading" to the reading list section and id="recommendations-heading" to its <h2>
  • scripts/smoke.mjs — new check (build.mjs group) that runs the build and asserts all five attributes appear in the output HTML, so this class of regression will be caught by CI going forward.

Tests

20 checks passed.   # was 19

npm test and npm run build both pass cleanly.


Generated by Claude Code

The page() function in build.mjs was missing aria-labelledby attributes
on all four <section> elements, and the "Reading list" <h2> was also
missing its id. Screen readers would encounter four unlabeled section
landmarks with no way to distinguish them.

The development reader (src/reader/reader.html) already has the correct
attributes; this aligns the build output to match. Advances issue #5.

Adds a smoke test that runs the build and asserts all five attributes are
present so this class of regression will be caught by CI.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants