Skip to content

fix(a11y): Move focus explicitly to main on skip link activation#93

Merged
ebouchut merged 3 commits into
devfrom
fix/skip-link-explicit-focus
Jul 12, 2026
Merged

fix(a11y): Move focus explicitly to main on skip link activation#93
ebouchut merged 3 commits into
devfrom
fix/skip-link-explicit-focus

Conversation

@ebouchut

@ebouchut ebouchut commented Jul 12, 2026

Copy link
Copy Markdown
Owner

This PR improves accessibility for screen-reader users using Skip to main content.
It ensures that:

  • Skip to main content always jumps to the main landmark (the <main> tag in our case)
  • The main tag is not outlined (meaning no ring/border around it)

How?

  • Add tabindex="-1" to the main landmark of all the page templates so that activating the "Skip to main content" link moves focus onto main explicitly, instead of relying on the browser's sequential focus navigation starting point (more robust with older assistive technologies).
  • Suppress the focus ring on main with a main:focus rule in base.css:
  • Keyboard activation of the skip link makes main match the global:focus-visible rule.
  • This drew a 2px outline around the whole content region (verified in a browser).
  • The landmark is not interactive, so WCAG 2.4.7 does not apply to it.

Update docs/rgaa-audit.md to mark the corresponding recommendation as implemented.

ebouchut added 3 commits July 12, 2026 21:35
Dossier appendix (French): Lighthouse 13.4.0 and axe-core 4.12.1 run
against every page of the running application at dev commit 8c82a93,
including the authenticated dashboard (real session) and the register
error state. Every page scores 100/100 on Lighthouse and zero axe
violations under the WCAG 2.1 A/AA rule set.

The manual keyboard walkthrough records the full tab order with a
visible 2 px focus ring on all 12 stops, proves the skip link works
(the Tab after activating it lands in the form), and completes a
keyboard-only login. axe's color-contrast incomplete items are resolved
manually against the computed token ratios (worst shipped pair 4.73:1).

One robustness recommendation: add tabindex=-1 on main#main so the
skip link moves focus explicitly. The reproduction commands are in the
report; docs/rgaa.md now links to it and its remaining-passes list
shrinks to the VoiceOver smoke test.
Both glossaries gain the two audit tools referenced by the new RGAA
self-audit report, in the build and tooling section, EN and FR kept in
sync per the glossary rule.
Add tabindex="-1" to the main landmark of all 7 page templates so
activating the "Skip to main content" link moves focus onto main
explicitly, instead of relying on the browser's sequential focus
navigation starting point (more robust with older assistive
technologies).

Suppress the focus ring on main with a main:focus rule in base.css:
keyboard activation of the skip link makes main match the global
:focus-visible rule, which drew a 2px outline around the whole content
region (verified in a browser). The landmark is not interactive, so
WCAG 2.4.7 does not apply to it.

Mark the corresponding recommendation in docs/rgaa-audit.md as
implemented.
@ebouchut ebouchut self-assigned this Jul 12, 2026
@ebouchut ebouchut added this to the v0.9 - Code Freeze milestone Jul 12, 2026
@ebouchut ebouchut merged commit a29a6a2 into dev Jul 12, 2026
5 checks passed
@ebouchut ebouchut deleted the fix/skip-link-explicit-focus branch July 12, 2026 21:01
@codecov

codecov Bot commented Jul 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.30%. Comparing base (1b593c1) to head (f4a7501).
⚠️ Report is 4 commits behind head on dev.

Additional details and impacted files
@@            Coverage Diff            @@
##                dev      #93   +/-   ##
=========================================
  Coverage     81.30%   81.30%           
  Complexity       62       62           
=========================================
  Files            23       23           
  Lines           246      246           
  Branches         13       13           
=========================================
  Hits            200      200           
  Misses           32       32           
  Partials         14       14           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ebouchut ebouchut added documentation Improvements or additions to documentation accessibility Accessibility (RGAA, WCAG) labels Jul 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

accessibility Accessibility (RGAA, WCAG) documentation Improvements or additions to documentation frontend

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant