Skip to content

fix(anchor-menu): keep sticky menu keyboard-reachable at 200% zoom - #1713

Merged
mlsamuelson merged 1 commit into
devfrom
UDS-2160
Jul 7, 2026
Merged

fix(anchor-menu): keep sticky menu keyboard-reachable at 200% zoom#1713
mlsamuelson merged 1 commit into
devfrom
UDS-2160

Conversation

@juanmitriatti

@juanmitriatti juanmitriatti commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Description

At 200% desktop zoom, the anchor menu became unreachable by keyboard — tabbing skipped it entirely (accessibility audit, UDS-1638 / UDS-2160).

Root cause: the sticky behavior moved the menu node into the global header (appendChild). Tab order follows DOM order, so the menu's controls jumped to a point earlier in the document than the user's current focus, and forward Tab never landed on them.

Fix: pin the menu with CSS (position: fixed; top: var(--uds-anchor-menu-top)) instead of relocating the node, with attach/detach driven by a scroll threshold. This matches how the unity-react-core AnchorMenu already positions itself. Fixes WCAG 2.1.1 (Keyboard) and 2.4.3 (Focus Order).

Testing Steps

  1. Open Atoms → Anchor Menu in the unity-bootstrap-theme Storybook.
  2. Set browser zoom to 200% (or narrow the window below ~640px) — the menu collapses to the "On This Page:" bar.
  3. Scroll down so the menu sticks below the header, then Tab from the top of the page. Expected: focus reaches the "On This Page:" toggle and its links. Before this change, Tab skipped the menu.
  4. Regression check at normal zoom: expanded menu still sticks, links reachable, click-to-scroll and active-link highlighting work, menu detaches when scrolling back to top.

Checklist

  • Tests pass for relevant code changes

Links

The sticky behavior relocated the menu in the DOM (globalHeader.appendChild),
which moved its focusable controls out of the keyboard tab order. At 200%
desktop zoom (effective width < lg) the menu is a collapsed sticky bar, so
forward Tab skipped it entirely and keyboard users could not reach it.

Pin the menu in place with CSS (position: fixed; top: var(--uds-anchor-menu-top))
instead of moving the node, mirroring the unity-react-core AnchorMenu. The node
never leaves its document position, so tab order is preserved. Attach/detach is
now driven by a scroll threshold against the stored original offset rather than
the live rect of a now-fixed element.

Fixes WCAG 2.1.1 Keyboard (Level A) and 2.4.3 Focus Order (Level A).
UDS-1638 / UDS-2160
@juanmitriatti
juanmitriatti requested a review from a team as a code owner June 9, 2026 11:03
@juanmitriatti juanmitriatti self-assigned this Jun 9, 2026
@asu-jenkins-devops

Copy link
Copy Markdown
Collaborator

@mlsamuelson mlsamuelson left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

AI generated descriptions can be a bit wordy and add more time to read to review. Perhaps they can be made more brief?

Ran into an issue testing this - both the current live Bootstrap version of the anchor menu and the one displayed here don't provide the chevron for the dropdown, so I'm unable to verify: https://unity-uds-staging.s3.us-west-2.amazonaws.com/pr-1713/@asu/unity-react-core/index.html?path=/story/components-anchormenu--default

@juanmitriatti

juanmitriatti commented Jul 7, 2026

Copy link
Copy Markdown
Contributor Author

AI generated descriptions can be a bit wordy and add more time to read to review. Perhaps they can be made more brief?

Ran into an issue testing this - both the current live Bootstrap version of the anchor menu and the one displayed here don't provide the chevron for the dropdown, so I'm unable to verify: https://unity-uds-staging.s3.us-west-2.amazonaws.com/pr-1713/@asu/unity-react-core/index.html?path=/story/components-anchormenu--default

@mlsamuelson you're right about description I just adjusted it.

Note on the earlier test: the story linked in the review is the unity-react-core AnchorMenu, this PR only changes the unity-bootstrap-theme version, so that story wouldn't show the fix. The right one is below.

Story: anchor-menu

QA steps (I just ran these against the staging build )

  1. Open the story above.
  2. Set browser zoom to 200% on desktop, or narrow the window to ~640px the menu collapses to the "On This Page:" bar. (No chevron will show next to it ,Font Awesome isn't bundled with Unity per the Get Started docs, which is why it's also missing on the live Storybook. Pre-existing and unrelated to this change. @davidornelas11 please confirm if Im wrong.)
  3. Scroll down until the menu sticks below the header.
  4. Click into the top of the page and Tab forward. Expected: focus lands on the "On This Page:" toggle; Enter opens it; further Tabs reach the five anchor links (First item → Fifth item). Before this fix, Tab skipped the menu entirely.
  5. Regression check at normal zoom/full width: the expanded menu still sticks below the header, links scroll-to-section and highlight, and the menu detaches when you scroll back to the top.

@mlsamuelson
mlsamuelson merged commit 8f8a59f into dev Jul 7, 2026
2 checks passed
@mlsamuelson
mlsamuelson deleted the UDS-2160 branch July 7, 2026 19:24
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.

3 participants