Skip to content

Hds 2624 table of contents should move focus#1502

Merged
mrTuomoK merged 3 commits intodevelopmentfrom
hds-2624-table-of-contents-should-move-focus
Apr 3, 2025
Merged

Hds 2624 table of contents should move focus#1502
mrTuomoK merged 3 commits intodevelopmentfrom
hds-2624-table-of-contents-should-move-focus

Conversation

@timwessman
Copy link
Contributor

@timwessman timwessman commented Apr 2, 2025

Description

  • If a user navigates to an anchor link (like form table of contents) focus moves to the linked heading

  • HDS-2639 (second commit) heading text is inside of an anchor element, so the whole heading is a link

  • No need to set tabIndex for headings because those are links and are keyboard-navigable

  • Note: Navigation or Side navigation should not move focus (other than to the beginning of the document)

Related Issue

Closes HDS-2624
Closes HDS-2627
Closes HDS-2639

Motivation and Context

  • Accessibility improvements

How Has This Been Tested?

  • /components/login/ has a good table of contents to test this

Demos:

Links to demos are in the comments

Screenshots (if appropriate):

Add to changelog

  • Added needed line to changelog

@timwessman timwessman force-pushed the hds-2624-table-of-contents-should-move-focus branch from 311343d to d5a19d6 Compare April 2, 2025 16:24
@github-actions
Copy link

github-actions bot commented Apr 2, 2025

Test Results

  1 files   68 suites   17m 39s ⏱️
 88 tests  88 ✅ 0 💤 0 ❌
176 runs  176 ✅ 0 💤 0 ❌

Results for commit 224be5c.

♻️ This comment has been updated with latest results.

@mrTuomoK mrTuomoK force-pushed the hds-2624-table-of-contents-should-move-focus branch from d5a19d6 to 6d5ef4a Compare April 3, 2025 05:42
@github-actions
Copy link

github-actions bot commented Apr 3, 2025

Preview found from hds-demo docs/preview_1502

Demos

Docs
Core Storybook
React Storybook

@mrTuomoK
Copy link
Contributor

mrTuomoK commented Apr 3, 2025

Hmmm... without screenReader I can't see any focus on the headers? Is it correct (maybe it is 🤷 )? With the reader it's highlighted yes.

@timwessman timwessman force-pushed the hds-2624-table-of-contents-should-move-focus branch from 6d5ef4a to 822c44f Compare April 3, 2025 08:33
@timwessman timwessman force-pushed the hds-2624-table-of-contents-should-move-focus branch from 822c44f to 224be5c Compare April 3, 2025 09:34
Copy link
Contributor

@mrTuomoK mrTuomoK left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good fix 👍

@mrTuomoK mrTuomoK merged commit 06566dc into development Apr 3, 2025
9 checks passed
@mrTuomoK mrTuomoK deleted the hds-2624-table-of-contents-should-move-focus branch April 3, 2025 10:04
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