Skip to content

SubNav refactor#1248

Merged
rezrah merged 16 commits intomainfrom
rezrah/update-subnav-brand-refactor
Feb 23, 2026
Merged

SubNav refactor#1248
rezrah merged 16 commits intomainfrom
rezrah/update-subnav-brand-refactor

Conversation

@rezrah
Copy link
Collaborator

@rezrah rezrah commented Feb 10, 2026

Summary

Towards https://github.com/github/brand-marketing-design/issues/2606

Updatest the visual appearance of SubNav and deprecates one prop.

🔗 Docs
🔗 Storyboook

List of notable changes:

  • Applies brand refactor styles (gridline on by default)
  • deprecates hasShadow prop

What should reviewers focus on?

  • Check for edge cases
  • Review the before/afters in FIles Changes tab and try to spot inadvertent changes

Steps to test:

Supporting resources (related issues, external links, etc):

Contributor checklist:

  • All new and existing CI checks pass
  • Tests prove that the feature works and covers both happy and unhappy paths
  • Any drop in coverage, breaking changes or regressions have been documented above
  • UI Changes contain new visual snapshots (generated by adding update snapshots label to the PR)
  • All developer debugging and non-functional logging has been removed
  • Related issues have been referenced in the PR description

Reviewer checklist:

  • Check that pull request and proposed changes adhere to our contribution guidelines and code of conduct
  • Check that tests prove the feature works and covers both happy and unhappy paths
  • Check that there aren't other open Pull Requests for the same update/change

Screenshots:

Please try to provide before and after screenshots or videos

Before After
Screenshot 2026-02-20 at 14-18-47 components-subnav-features--dropdown-variant Screenshot 2026-02-20 at 14-18-28 components-subnav-features--dropdown-variant

@changeset-bot
Copy link

changeset-bot bot commented Feb 10, 2026

🦋 Changeset detected

Latest commit: aa41671

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 8 packages
Name Type
@primer/react-brand Patch
@primer/brand-primitives Patch
@primer/brand-docs Patch
@primer/brand-css Patch
@primer/brand-e2e Patch
@primer/brand-fonts Patch
@primer/brand-config Patch
@primer/brand-storybook Patch

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

@github-actions
Copy link
Contributor

github-actions bot commented Feb 10, 2026

🔍 Design token changes found

View CSS variable changes
+ --brand-SubNav-bgColor: var(--brand-color-canvas-default);
- --brand-SubNav-color-subMenu-bgColor: var(--base-color-scale-white-0);
+ --brand-SubNav-color-link-bgColor: #e4ebe6;
+ --brand-SubNav-bgColor: var(--brand-color-canvas-default);
- --brand-SubNav-color-subMenu-bgColor: var(--base-color-scale-white-0);
+ --brand-SubNav-color-link-bgColor: #323834;

@github-actions
Copy link
Contributor

github-actions bot commented Feb 10, 2026

🟢 Unit test coverage changes found

Unit test coverage has been updated through this PR.

Changes: 0 new tests, 0 removed tests, 1 improved, 1 decreased

Component/Hook Statements Functions Branches Change
SubNav 86.0% 87.0% 84.8% 85.1% 77.7% 77.5% +1.0%

@github-actions
Copy link
Contributor

github-actions bot commented Feb 10, 2026

🟢 No visual differences found

Our visual comparison tests did not find any differences in the UI.

@rezrah rezrah requested a review from danielguillan February 20, 2026 14:19
@rezrah rezrah marked this pull request as ready for review February 20, 2026 14:19
@rezrah rezrah requested a review from a team as a code owner February 20, 2026 14:19
Copilot AI review requested due to automatic review settings February 20, 2026 14:19
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Refactors the SubNav component to match updated Brand styles (including borders/gridlines by default), introduces new SubNav design tokens, and updates tests/docs/snapshots. It also propagates aria-current support through the FlexTemplate recipe so “current page” state can be reflected in SubNav links.

Changes:

  • Refactor SubNav markup/styling (icons, active states, narrow overlay behavior) and deprecate hasShadow.
  • Add aria-current support to FlexTemplate link types + stories and pass it through to SubNav.Link.
  • Update visual testing (snapshots, flaky-story skipping) and docs/changesets/tokens for the new SubNav look.

Reviewed changes

Copilot reviewed 13 out of 40 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
packages/react/src/recipes/FlexTemplate/examples/FlexTemplate.examples.stories.tsx Marks “current” FlexTemplate links in examples via aria-current.
packages/react/src/recipes/FlexTemplate/FlexTemplate.types.ts Extends link type to support 'aria-current'.
packages/react/src/recipes/FlexTemplate/FlexTemplate.tsx Passes aria-current through to SubNav.Link.
packages/react/src/SubNav/SubNav.tsx Core SubNav refactor: icons, narrow toggle structure/ARIA, overlay sizing, active state class.
packages/react/src/SubNav/SubNav.module.css New SubNav visuals (borders, typography, pill active styles, overlay layout tweaks).
packages/react/src/SubNav/SubNav.module.css.d.ts CSS module typings updated for new class names.
packages/react/src/SubNav/SubNav.test.tsx Updates unit tests to reflect new behavior (separator test removed, new accessible-name expectations).
packages/react/src/SubNav/SubNav.visual.spec.ts Removes flaky “Anchor Nav Variant” visual test while keeping narrow/other scenarios.
packages/react/src/SubNav/SubNav.visual.spec.ts-snapshots/Visual-Comparison-SubNav-SubNav-Sub-Heading-1-linux.png Updated visual snapshot for new styling.
packages/react/src/SubNav/SubNav.visual.spec.ts-snapshots/Visual-Comparison-SubNav-SubNav-Full-Width-1-linux.png Updated visual snapshot for new styling.
packages/react/src/SubNav/SubNav.visual.spec.ts-snapshots/Visual-Comparison-SubNav-SubNav-Forwarded-Refs-1-linux.png Updated visual snapshot for new styling.
packages/react/src/SubNav/SubNav.visual.spec.ts-snapshots/Visual-Comparison-SubNav-SubNav-Default-1-linux.png Updated visual snapshot for new styling.
packages/react/src/SubNav/SubNav.visual.spec.ts-snapshots/Visual-Comparison-SubNav-SubNav-Anchor-Nav-Default-Link-Variant-1-linux.png Updated visual snapshot for new styling.
packages/react/src/SubNav/SubNav.visual.spec.ts-snapshots/Visual-Comparison-SubNav-SubNav-Active-Sub-Heading-1-linux.png Updated visual snapshot for new styling.
packages/react/src/SubNav/SubNav.visual.spec.ts-snapshots/Visual-Comparison-SubNav-Mobile-viewport-test-for-Sub-Heading-Narrow-SubNav-Sub-Heading-Narrow-1-linux.png Updated mobile snapshot for new styling.
packages/react/src/SubNav/SubNav.visual.spec.ts-snapshots/Visual-Comparison-SubNav-Mobile-viewport-test-for-Full-Width-Narrow-SubNav-Full-Width-Narrow-1-linux.png Updated mobile snapshot for new styling.
packages/react/src/SubNav/SubNav.visual.spec.ts-snapshots/Visual-Comparison-SubNav-Mobile-viewport-test-0855d-ing-Narrow-SubNav-Active-Sub-Heading-Narrow-1-linux.png Updated mobile snapshot for new styling.
packages/e2e/scripts/playwright/update-visual-snapshots Allows passing extra Playwright args through the snapshot update script.
packages/e2e/scripts/playwright/playwright.generate-tests.ts Skips the flaky anchor-nav variant story in generated visual tests.
packages/design-tokens/src/tokens/functional/components/sub-nav/colors.js Adds/adjusts SubNav tokens (background + link bgColor).
apps/next-docs/content/components/SubNav/index.mdx Removes hasShadow docs/example and updates props table.
.changeset/proud-pans-cross.md Changeset for new SubNav tokens in @primer/brand-primitives.
.changeset/icy-cities-swim.md Changeset documenting SubNav refactor + hasShadow deprecation + Action variant change.

Copy link
Contributor

@danielguillan danielguillan left a comment

Choose a reason for hiding this comment

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

Great updates! They work perfectly.

Comment on lines 4 to 5
value: 'var(--base-color-scale-white-0)',
dark: '#000',
Copy link
Contributor

Choose a reason for hiding this comment

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

We should be able to use --(--brand-color-cavas-default) here, which maps to white-0 (#fff) and black-0 (#000) and is semantically appropriate.

Copy link
Collaborator Author

@rezrah rezrah Feb 23, 2026

Choose a reason for hiding this comment

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

perfect, thanks Dani. I assumed that we don't use #000 exactly for black-0, but that's only in light mode. Now both use canvas.

Comment on lines 32 to 33
font-size: calc(var(--base-size-16) - 1px);
line-height: calc(var(--base-size-16) - 1px);
Copy link
Contributor

Choose a reason for hiding this comment

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

🙈 Is that 1px difference significant enough to warrant deviating from the type scale?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I know 😅. This matches the design exactly. I normally would push for standardisation but 16px IMO did feel a bit too big, and we don't have anything lower until 12px. As it's the SubNav I think it's okay as a one-off, but let me add an annotation to make it clear it's an exception. Does that work for you @danielguillan?

cc @jesussandreas

@rezrah rezrah merged commit 39772c1 into main Feb 23, 2026
23 checks passed
@rezrah rezrah deleted the rezrah/update-subnav-brand-refactor branch February 23, 2026 11:47
@primer primer bot mentioned this pull request Feb 23, 2026
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