Repository navigation
fix: accessibility fixes for page title, nav drawer, version menu and mobile search - #2065
Merged
Merged
Conversation
… mobile search - Recreate Gatsby Head nodes in the HTML namespace so document.title is set - Use theme colors for the mobile nav drawer so nav items have sufficient contrast - Use the default foreground color for CLI version menu links - Constrain the mobile search results panel so all results can be scrolled into view Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The targeted namespace and styling changes have no identified blocking issues.
No open issues 🎉
What changed in this PR
Improves docs-site accessibility by restoring page titles, correcting navigation contrast, and keeping mobile search results scrollable.
Changes:
- Converts Gatsby head elements to the HTML namespace.
- Uses theme foreground and background colors for navigation controls.
- Allows mobile search results to shrink within the viewport.
| File | Description |
|---|---|
src/components/variant-select.module.css |
Sets accessible version-link colors. |
src/components/variant-select.js |
Applies the version-link style. |
src/components/search.module.css |
Makes the search theme wrapper shrinkable. |
src/components/nav-drawer.module.css |
Restores theme-based drawer contrast. |
gatsby-browser.js |
Repairs namespaces on Gatsby head elements. |
Review effort: Balanced
- Move ThemeProvider from wrapRootElement to wrapPageElement so no div is rendered inside Head - Use leadingVisual instead of the unsupported leadingIcon prop on the mobile table of contents button - Remove code comments Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…avigation lists - Render CLI version menu entries as ActionList.LinkItem so the focused element is the menuitem inside its labelled group - Add list position to sidebar navigation links and page navigation hierarchy links Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
nishantms
approved these changes
Oct 21, 2026
v-kartykp
force-pushed
the
kartykp/ally-fixes-2026-batch-1
branch
from
October 21, 2026 20:51
5f56779 to
c783f9a
Compare
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Accessibility fixes for the docs site's page title, mobile navigation drawer, CLI version menu, navigation lists, and mobile search results.
Changes
Page title missing from
document.title(gatsby-browser.js)To prevent React 19 from hoisting metadata tags, Gatsby renders the
Headexport inside an<svg>. This creates the<title>and<meta>elements in the SVG namespace, and Gatsby then copies them into<head>in place of the server-rendered tags. Browsers and assistive technology ignore an SVG<title>, sodocument.titlewas an empty string on every page once the client-side code loaded.An
onClientEntryhook now adds aMutationObserveron<head>. It recreates any non-HTML-namespaced[data-gatsby-head]node as an HTML element with the same attributes and content. This works the same way as Gatsby's own handling of<script>tags.document.titleis now correct on initial load and after client-side navigation, including navigation from search results.Mobile nav drawer contrast (
nav-drawer.module.css)When the drawer moved from
sxprops to CSS modules, its background was hardcoded to#333333. The drawer content is still rendered insideLightTheme, so the nav items use the light theme's dark text, which gave roughly 1.2:1 contrast. The drawer body now uses--bgColor-default/--fgColor-default, matching the originalcanvas.default/fg.defaulttheme values.CLI version menu link contrast (
variant-select.js,variant-select.module.css)Version menu items were rendered with the Primer link accent color (
#0969da). On the selected item's background this is 4.46:1, below the 4.5:1 minimum. The menu links now use--fgColor-default, like other action menu items.Mobile search results not fully visible (
search.module.css)Primer's
ThemeProviderwrapsLightThemecontent in a<div data-color-mode>. That wrapper became the flex item inside the mobile search overlay, so the results list grew to its full content height instead of shrinking and scrolling. On short viewports (for example 320 × 256 px or at 200% zoom), most results were off-screen. The wrapper is now a shrinkable flex column, so the results panel fits the remaining viewport height and scrolls.Console warnings (
root.js,page.js,table-of-contents.js)wrapRootElementto theHeadexport as well as to pages. Primer'sThemeProviderrenders a<div data-color-mode>, so a<div>ended up insideHead, causing the "<div>is not a valid head element" warning.ThemeProvidernow lives inwrapPageElement, which Gatsby does not apply toHead.MDXProviderstays inwrapRootElement.leadingIcon, which Primer'sButtondoesn't support. React warned about an unknown DOM prop and the open/closed chevron never rendered. It now usesleadingVisual, so the chevron shows.CLI version menu group and list semantics (
variant-select.js,variant-select.module.css)Each version entry rendered a
role="menuitem"<li>with a separate<a>inside it, and keyboard focus moved to that inner link. Screen readers in focus mode announced only "Version x, link". They didn't announce the "Current"/"Legacy" group or the item's position in the menu. The entries now useActionList.LinkItemwith our Gatsby-aware link as theascomponent. The focused element is now the<a role="menuitem">inside its labelledrole="group", so the group name and position are announced. Client-side version switching, closing the menu and returning focus to the menu button work as before. This also stopsstate="[object Object]"from being rendered as a DOM attribute on the menu items.Position information for navigation lists (
nav-items.js,nav-hierarchy.js)Sidebar navigation links and the page-level navigation hierarchy lists now include their position in the accessible name (for example, "npm access, 2 of 74"). This matches the table of contents and search results. Expandable sidebar items keep their existing name, because Primer's
NavListuses that name to label the expanded sub-list.Testing
gatsby developin a browser:document.titleis correct on initial load and after navigating through search and the sidebar. No SVG-namespaced nodes remain in<head>.#1f2328on the selected item background.leadingIconprop messages in the browser console. The mobile table of contents button shows its chevron.role="menuitem"links inside the "Current"/"Legacy" groups. Selecting a version with Enter or a click navigates to that version, closes the menu and returns focus to the menu button.npm testandnpm run lintpass.