fix(root): focus section headings from contents navigation - #1895
sylvesterkaczmarek wants to merge 7 commits into
Conversation
|
Please can you rebase this pull request? |
bfd7013 to
ee76fad
Compare
|
Rebased onto the latest develop. Thanks! |
GCHQ-Developer-299
left a comment
There was a problem hiding this comment.
I'm not sure this Pull Request remedies the ticket. I think that's partly an issue with the ticket lacking descriptiveness.
My understanding is that the ticket's problem is that (specifically on the design principles page) when you scroll down the page, some of the items in the Table of Contents are skipped, instead of being highlighted as you go.
I think this is because each section on the design principles page only contains a line or two of text, so the window for that Heading to be active is very small.
This pull request doesn't fix the issue with titles being skipped, nor does it move the focus of NVDA screenreader when I tested locally. The former behaviour being similar between main branch and this is shown below:
Screen.Recording.2026-08-27.at.12.44.42.mov
…ag-announcement docs: explain status tag announcements
…cker-validation docs: clarify date picker validation
…igation-links fix(root): render secondary navigation items as links
ee76fad to
bd62fd8
Compare
|
Thanks for clarifying the expected behaviour. I’ve reworked the fix around the Design Principles case: each section now remains active until the next heading reaches the activation line, so the short sections are no longer skipped. Selecting a contents link also explicitly updates the hash, scrolls to the heading, and moves DOM focus to it. I rebased onto current |
069fb2e to
3230dbf
Compare
Summary
Keep the page contents navigation in sync with the section currently being read, and move focus to section headings when contents links are activated.
Problem
On pages with short sections, including Design principles, observing only the heading elements could cause contents entries to be skipped while scrolling. The previous change also did not reliably move screen-reader focus to the selected heading.
Fix
tabIndex={-1}.Validation
npm run prettier,npm run verify-ts,npm run lint,npm test, andnpm run buildpass locally.Closes #1266