Repository navigation
[CLOV-CSS] Migrate bpk-component-horizontal-nav to CSS custom properties - #4947
Conversation
- Replace static SASS tokens with CSS var() + SASS fallbacks in SCSS modules - BpkHorizontalNav.module.scss: underline borders use --bpk-other-line-default - BpkHorizontalNavItem.module.scss: - default link: color uses --bpk-text-secondary - hover border uses --bpk-surface-highlight - active border uses --bpk-other-line-default - disabled color uses --bpk-text-disabled - selected border and color use --bpk-text-deprecated-link - light link: color and border use --bpk-text-on-dark - light disabled: --bpk-text-disabled - Removes bpk-themeable-property mixin usage - BpkHorizontalNav.stories.module.scss: custom-color uses --bpk-surface-success-fill - Add VisualTestDark story using BpkDarkExampleWrapper Closes #4823 Co-Authored-By: Claude Sonnet 4.6 (1M context) <[email protected]>
|
Visit https://backpack.github.io/storybook-prs/4947 to see this build running in a browser. |
There was a problem hiding this comment.
Pull request overview
Note
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Migrates bpk-component-horizontal-nav styling from SCSS theme mixins to CSS custom properties (with SASS token fallbacks) and adds a dark-mode visual regression story.
Changes:
- Replaces
bpk-themeable-propertyusage withvar(--token, sassFallback)across horizontal nav styles. - Updates underline/link/border colors to new CSS custom property tokens, including light variant and disabled/selected states.
- Adds
VisualTestDarkStorybook story wrapped inBpkDarkExampleWrapperand taggeddark-mode-compatible.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| packages/backpack-web/src/bpk-component-horizontal-nav/src/BpkHorizontalNavItem.module.scss | Switches nav item colors/borders to CSS custom properties with token fallbacks; removes previous themeable-property hooks. |
| packages/backpack-web/src/bpk-component-horizontal-nav/src/BpkHorizontalNav.module.scss | Updates underline border color to use CSS custom property --bpk-other-line-default with fallback. |
| packages/backpack-web/src/bpk-component-horizontal-nav/src/BpkHorizontalNav.stories.module.scss | Migrates custom scroll indicator color to CSS custom property with fallback. |
| packages/backpack-web/src/bpk-component-horizontal-nav/src/BpkHorizontalNav.stories.js | Adds a new dark visual test story and associated Storybook parameters/tags. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| color: var(--bpk-text-secondary, tokens.$bpk-text-secondary-day); | ||
|
|
||
| @include utils.bpk-hover { | ||
| color: var(--bpk-text-secondary, tokens.$bpk-text-secondary-day); | ||
|
|
||
| @include borders.bpk-border-bottom-xl( | ||
| tokens.$bpk-surface-highlight-day | ||
| ); | ||
| @include utils.bpk-themeable-property( | ||
| color, | ||
| --bpk-horizontal-nav-link-hover-color, | ||
| tokens.$bpk-text-secondary-day | ||
| var(--bpk-surface-highlight, tokens.$bpk-surface-highlight-day) | ||
| ); | ||
| } | ||
|
|
||
| &:active { | ||
| @include borders.bpk-border-bottom-xl(tokens.$bpk-line-day); | ||
| @include utils.bpk-themeable-property( | ||
| color, | ||
| --bpk-horizontal-nav-link-active-color, | ||
| tokens.$bpk-text-secondary-day | ||
| color: var(--bpk-text-secondary, tokens.$bpk-text-secondary-day); | ||
|
|
||
| @include borders.bpk-border-bottom-xl( | ||
| var(--bpk-other-line-default, tokens.$bpk-line-day) | ||
| ); | ||
| } |
There was a problem hiding this comment.
Confirmed — this is a real, intentional API change flagged for design/PR-owner sign-off, not a code bug. The values themselves are correct (verified in the token-value audit comment on this PR: --bpk-text-secondary matches $bpk-text-secondary-day, --bpk-surface-highlight matches $bpk-surface-highlight-day exactly, light and dark). The tradeoff is real though: any consumer currently overriding --bpk-horizontal-nav-link-color/-hover-color/-active-color via BpkThemeProvider will silently lose that override, since these component-scoped hooks are being replaced by global semantic vars rather than kept as legacy fallbacks. This same pattern recurs across the whole CSS-vars migration series (switch, radio, star-rating, progress, skip-link, label) — worth a one-time design-system-owner decision on whether legacy hooks should be preserved as fallbacks, rather than resolving PR-by-PR.
| color: var(--bpk-text-deprecated-link, tokens.$bpk-text-link-day); | ||
|
|
||
| @include borders.bpk-border-bottom-xl( | ||
| var( | ||
| --bpk-horizontal-nav-bar-selected-color, | ||
| --bpk-text-deprecated-link, | ||
| tokens.$bpk-horizontal-nav-bar-selected-color | ||
| ) | ||
| ); |
There was a problem hiding this comment.
Same as above — this is the same intentional pattern (component hook -> global var), not a value bug. --bpk-text-deprecated-link is confirmed to resolve to the same colour (#0062e3 light / #84e9ff dark) as both the old $bpk-text-link-day and $bpk-horizontal-nav-bar-selected-color tokens, so there's no visual regression — but consumers overriding --bpk-horizontal-nav-bar-selected-color directly will lose that override. Flagging for design-system-owner sign-off alongside the other comment on this file.
|
Visit https://backpack.github.io/storybook-prs/4947 to see this build running in a browser. |
|
Token value audit — verified every new CSS var against
All new/old values match — no visual regression risk from this migration. |
|
GitHub-wide usage search for the removed theming hooks ( Searched github.com (via Results — no real consumer usage found. All hits are within:
No product repo anywhere in the org (or public GitHub) uses these specific theme attribute keys via Conclusion: safe to merge. This is a breaking API change in theory, but zero real consumers rely on it today. |
Closes #4823
Migrates
bpk-component-horizontal-navSCSS modules to CSS custom properties with SASS fallbacks for light/dark mode support.Changes
BpkHorizontalNav.module.scsstokens.$bpk-line-day→var(--bpk-other-line-default, ...)BpkHorizontalNavItem.module.scsstokens.$bpk-text-secondary-day→var(--bpk-text-secondary, ...)tokens.$bpk-surface-highlight-day→var(--bpk-surface-highlight, ...)tokens.$bpk-line-day→var(--bpk-other-line-default, ...)tokens.$bpk-text-disabled-day→var(--bpk-text-disabled, ...)--bpk-horizontal-nav-bar-selected-colorhook →var(--bpk-text-deprecated-link, ...)tokens.$bpk-text-on-dark-day→var(--bpk-text-on-dark, ...)bpk-themeable-propertymixin usage in favour of plainvar()BpkHorizontalNav.stories.module.scsstokens.$bpk-status-success-fill-day→var(--bpk-surface-success-fill, ...)BpkHorizontalNav.stories.jsVisualTestDarkstory usingBpkDarkExampleWrappertaggeddark-mode-compatible