From 750c0478d449f2913074979ab6a49e2b615c7593 Mon Sep 17 00:00:00 2001 From: MarcusA <71977744+MarcusAl@users.noreply.github.com> Date: Fri, 5 Jun 2026 16:36:16 +0100 Subject: [PATCH] fix(a11y): structural WCAG 2.1 AA fixes on overview report MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add lang="en" on so screen readers and translation features pick the correct language for the entire report. - Give the navbar menu-toggle anchor an accessible name via aria-label. - Make per-rating summary IDs unique (rating--{files,churns,smells}) so the HTML spec's unique-ID requirement holds and JS/test selectors can target individual cells. Verified via pa11y --standard WCAG2AA on overview.html: before 50 errors after 34 errors (-16: -15 dup IDs, -1 missing lang, +1 anchor label) Remaining 34 (deliberately out of scope for this PR): - 30 G18 + 3 G145 contrast violations on #A4A4A4 grays — opinionated style change, would prefer maintainer-led decision before changing. - 1 F77 duplicate id="page-content-wrapper" — cross-page (affects overview/smells_index/simple_cov_index templates), separate scope. Tests + RuboCop green. Test snapshot under test/samples/ auto-updated to reflect the new template output. --- CHANGELOG.md | 2 ++ .../generators/html/templates/layouts/application.html.erb | 4 ++-- lib/rubycritic/generators/html/templates/overview.html.erb | 6 +++--- test/samples/simple_cov_index.html | 4 ++-- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4d9d05a3..bb057bd8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ * [FEATURE] ... * [CHANGE] Replace all Cucumber features with Minitest/Spec specs (by [@faisal][]) +* [BUGFIX] Add `lang="en"` to the report's `` element, give the menu-toggle anchor an `aria-label`, and make the per-rating summary IDs unique. Fixes 17 WCAG 2.1 AA structural errors on `overview.html`. (by [@MarcusAl][]) # v5.0.0 / 2026-01-26 [(commits)](https://github.com/whitesmith/rubycritic/compare/v4.12.0...v5.0.0) @@ -504,3 +505,4 @@ [@fbuys]: https://github.com/fbuys [@exoego]: https://github.com/exoego [@raff-s]: https://github.com/raff-s +[@MarcusAl]: https://github.com/MarcusAl diff --git a/lib/rubycritic/generators/html/templates/layouts/application.html.erb b/lib/rubycritic/generators/html/templates/layouts/application.html.erb index fae2e5e8..1c1f328a 100644 --- a/lib/rubycritic/generators/html/templates/layouts/application.html.erb +++ b/lib/rubycritic/generators/html/templates/layouts/application.html.erb @@ -1,5 +1,5 @@ - + @@ -16,7 +16,7 @@