[Brand Refactor] Update SubdomainNavBar - #1402
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: ed05986d-edce-42e8-8d89-da23c403edda
🦋 Changeset detectedLatest commit: 2c719b4 The changes in this PR will be included in the next version bump. This PR includes changesets to release 9 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
🔍 Design token changes foundView CSS variable changes+ --brand-SubdomainNavBar-color-link-bgColor: var(--base-color-scale-gray-1);+ --brand-SubdomainNavBar-searchDialog-shadowColor: rgba(0, 0, 0, 0.1);+ --brand-SubdomainNavBar-searchDialog-backdropColor: rgba(0, 0, 0, 0.2);+ --brand-SubdomainNavBar-color-link-bgColor: var(--base-color-scale-gray-6);+ --brand-SubdomainNavBar-searchDialog-shadowColor: rgba(0, 0, 0, 0.1);+ --brand-SubdomainNavBar-searchDialog-backdropColor: rgba(0, 0, 0, 0.2); |
🟢 Bundle size report
|
🟢 Unit test coverage changes foundUnit test coverage has been updated through this PR. Changes: 0 new tests, 0 removed tests, 1 improved, 0 decreased
|
🟢 No visual differences foundOur visual comparison tests did not find any differences in the UI. |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: ed05986d-edce-42e8-8d89-da23c403edda
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: ed05986d-edce-42e8-8d89-da23c403edda
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 7d918370-0eb2-4a77-b692-e6b8b4d0d65e
…nnavbar Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 085743ed-8a5d-4c4f-a0db-260a81dcf121
There was a problem hiding this comment.
Pull request overview
Updates SubdomainNavBar to the brand-refactor visual style while expanding layout, search, and responsive navigation capabilities in the @primer/react-brand component library.
Changes:
- Refactors layout/styling (gridline design), adds
leadingComponent/trailingComponent, and introduces an imperative search ref API. - Reworks search UX (input-style trigger, keyboard shortcut config, grouped results, localized labels) and desktop overflow behavior (More menu + focus management).
- Updates supporting assets: docs, stories, unit tests, visual tests, E2E snapshot generation, and design tokens.
Show a summary per file
| File | Description |
|---|---|
| packages/react/src/SubdomainNavBar/useVisibilityObserver.ts | Replaces IntersectionObserver-based link visibility with measurement + ResizeObserver logic. |
| packages/react/src/SubdomainNavBar/SubdomainNavBarLinkContext.ts | Adds context for overflow state and link-click handling across visible/overflow menus. |
| packages/react/src/SubdomainNavBar/SubdomainNavBar.visual.spec.ts | Expands visual coverage for new stories and states (overflow, grouped results, mobile slot-only menu). |
| packages/react/src/SubdomainNavBar/SubdomainNavBar.tsx | Main component refactor: new slots, search API/UX, overflow accessibility behavior, and responsive updates. |
| packages/react/src/SubdomainNavBar/SubdomainNavBar.test.tsx | Adds extensive unit coverage for new behaviors (overflow, keyboard shortcuts, ref API, slots, dialog behavior). |
| packages/react/src/SubdomainNavBar/SubdomainNavBar.stories.tsx | Adds/updates Storybook stories to demonstrate new APIs and responsive behaviors. |
| packages/react/src/SubdomainNavBar/SubdomainNavBar.module.css.d.ts | Updates CSS module typings for new/removed classnames. |
| packages/react/src/SubdomainNavBar/SubdomainNavBar.module.css | Major style updates for gridline design, responsive layout, overflow menu, and search dialog. |
| packages/react/src/SubdomainNavBar/NavigationVisbilityObserver.tsx | Reworks desktop overflow measurement and introduces anchored overflow menu positioning and focus handling. |
| packages/e2e/scripts/playwright/playwright.generate-tests.ts | Adds per-story viewport/timeout/before-screenshot hooks for more reliable visual snapshots. |
| packages/design-tokens/src/tokens/functional/components/subdomain-nav-bar/colors.js | Adds token values for search dialog shadow/backdrop colors. |
| apps/next-docs/content/components/SubdomainNavBar/index.mdx | Updates documentation to match new props, search model, and accessibility guidance. |
| .changeset/tasty-cameras-search.md | Minor changeset documenting new slots, search APIs, and overflow behavior + token changes. |
| .changeset/quiet-pills-align.md | Patch changeset for desktop navigation pill state styling updates. |
Review details
- Files reviewed: 13/42 changed files
- Comments generated: 4
- Review effort level: Lite
…efactor-update-subdomainnavbar
| [children], | ||
| ) | ||
| const hasSearch = Boolean(searchItem) | ||
| const searchKeyboardShortcut = useMemo( |
There was a problem hiding this comment.
The keyboard shortcut should really be opt-in, as it's taking over on sites where that might be reserved already.
E.g.
Summary
Updates
SubdomainNavBarwith the new brand refactor styles and expands its content, search, and responsive navigation capabilities.Towards https://github.com/github/brand-experience/issues/223
List of notable changes:
SubdomainNavBarstyling with the new gridline design.leadingComponentandtrailingComponentcontent slots.openSearch()andcloseSearch()methods.What should reviewers focus on?
Steps to test:
SubdomainNavBarstories in the Storybook preview.Contributor checklist:
update snapshotslabel to the PR)Reviewer checklist:
Screenshots:
Desktop navigation
Search
Mobile menu