Repository navigation
[CLOV-CSS] Migrate bpk-component-skip-link to CSS custom properties - #4926
Conversation
|
Visit https://backpack.github.io/storybook-prs/4926 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-skip-link styling from legacy theme hooks to semantic CSS custom properties (with Sass fallbacks) and adds dark mode Storybook coverage, while also aligning inset banner styling with the same semantic variables.
Changes:
- Replaced legacy themeable-property usage with semantic CSS custom properties + Sass fallbacks in
BpkSkipLink.module.scss. - Removed per-component
themeAttributesexposure for skip link and updated its unit test. - Added
DarkModestories (wrapper-based) and updated inset banner SCSS to use semantic CSS variables.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/backpack-web/src/bpk-component-skip-link/src/themeAttributes.ts | Removes exported theme attributes for the component. |
| packages/backpack-web/src/bpk-component-skip-link/src/themeAttributes-test.js | Updates expectation to match the empty theme attributes list. |
| packages/backpack-web/src/bpk-component-skip-link/src/BpkSkipLink.stories.tsx | Adds a dark mode story using BpkDarkExampleWrapper. |
| packages/backpack-web/src/bpk-component-skip-link/src/BpkSkipLink.module.scss | Switches skip-link styling to semantic CSS variables with Sass fallbacks. |
| packages/backpack-web/src/bpk-component-inset-banner/src/BpkInsetBannerV3/BpkInsetBannerV3.module.scss | Uses semantic CSS vars for radius/text colors. |
| packages/backpack-web/src/bpk-component-inset-banner/src/BpkInsetBannerV2/BpkInsetBannerSponsored.module.scss | Uses semantic CSS vars for radius/text colors; annotates gaps. |
| packages/backpack-web/src/bpk-component-inset-banner/src/BpkInsetBanner.stories.tsx | Adds a dark mode story using BpkDarkExampleWrapper (with TS suppression). |
| packages/backpack-web/src/bpk-component-inset-banner/src/BpkInsetBanner.module.scss | Uses semantic CSS vars for radius/text colors/background with fallbacks. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| import { ArgTypes, Markdown } from '@storybook/addon-docs/blocks'; | ||
| import { BpkDarkExampleWrapper } from 'bpk-storybook-utils'; |
There was a problem hiding this comment.
Outdated — BpkSkipLink.stories.tsx is no longer part of this PR's current diff (superseded by a later commit, which only touches BpkSkipLink.module.scss now). No action needed.
| background-color: var( | ||
| --bpk-status-danger-spot, | ||
| tokens.$bpk-status-danger-spot-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 value itself is correct (verified in the token-value audit comment on this PR: --bpk-status-danger-spot matches $bpk-status-danger-spot-day exactly, light #e70866 / dark #ff649c). The tradeoff is real: any consumer currently overriding --bpk-skip-link-background-color via BpkThemeProvider will silently lose that override, since the component-scoped hook is being replaced by a global semantic var rather than kept as a legacy fallback. This same pattern recurs across the whole CSS-vars migration series (switch, radio, star-rating, progress, horizontal-nav, label) — worth a one-time design-system-owner decision on whether legacy hooks should be preserved as fallbacks, rather than resolving PR-by-PR.
| linkText: 'More information', | ||
| link: 'www.skyscanner.net', |
There was a problem hiding this comment.
This story content (the relative link string) pre-existed on main before this PR — not introduced by this migration. Out of scope for a CSS-vars migration PR; worth a separate cleanup PR if desired.
| border-radius: var(--bpk-radius-sm, tokens.$bpk-border-radius-sm); | ||
|
|
||
| &--with-body { | ||
| border-radius: tokens.$bpk-border-radius-sm tokens.$bpk-border-radius-sm 0 0; | ||
| border-radius: var(--bpk-radius-sm, tokens.$bpk-border-radius-sm) | ||
| var(--bpk-radius-sm, tokens.$bpk-border-radius-sm) 0 0; |
There was a problem hiding this comment.
Pre-existing pattern, not introduced by this PR — the repeated $bpk-border-radius-sm already existed on main before this migration. This PR migrated each occurrence to var() in place to keep the diff minimal and preserve existing behavior; extracting a shared local variable would be a good follow-up but is out of scope for this token-value migration.
| border-radius: 0 0 var(--bpk-radius-sm, tokens.$bpk-border-radius-sm) | ||
| var(--bpk-radius-sm, tokens.$bpk-border-radius-sm); |
There was a problem hiding this comment.
Same as the earlier comment on this pattern — pre-existing duplication, not introduced by this PR.
6f73f6d to
0691511
Compare
Replaces static SASS tokens with CSS var() calls and SASS fallbacks to enable light/dark theme switching. Removes legacy bpk-themeable-property hook and clears themeAttributes since global semantic vars are used. Adds dark mode Storybook story. Co-Authored-By: Claude Sonnet 4.6 (1M context) <[email protected]>
0691511 to
405f81a
Compare
|
Visit https://backpack.github.io/storybook-prs/4926 to see this build running in a browser. |
Vincent Liu (xiaogliu)
left a comment
There was a problem hiding this comment.
This PR removes @include utils.bpk-themeable-property(background-color, --bpk-skip-link-background-color, tokens.$bpk-status-danger-spot-day) and replaces it with background-color: var(--bpk-status-danger-spot, tokens.$bpk-status-danger-spot-day).
Problem: packages/backpack-web/src/bpk-component-skip-link/src/themeAttributes.ts still exports ['skipLinkBackgroundColor'], and theming.ts still declares a default for it. BpkThemeProvider will keep injecting an inline --bpk-skip-link-background-color CSS var, but nothing in the SCSS references that var name anymore — the theming hook is now silently dead. themeAttributes-test.js still asserts toEqual(['skipLinkBackgroundColor']) so this ships green with no test failure.
Either:
- Keep both — reference
--bpk-skip-link-background-colorwith the new--bpk-status-danger-spotas its fallback (nested var), or - Remove
skipLinkBackgroundColorfromthemeAttributes.ts/theming.ts/the test if the intent is to fully replace the component-scoped hook with the global semantic var — but that's a deliberate API change that should probably be called out in the PR description, since it removes a public theming key.
Other changes verified correct: --bpk-radius-sm (0.5rem, matches $bpk-border-radius-sm) and --bpk-text-on-dark (#ffffff in both light/dark themes, matches $bpk-text-on-dark-day) are both real vars with matching values.
|
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 hook ( Searched github.com (via Results — no real consumer usage found. Hits are limited to:
No product repo anywhere in the org overrides Conclusion: safe to merge. |
Closes #4814
Changes
Migrates
bpk-component-skip-linkSCSS to CSS custom properties with SASS fallbacks for light/dark mode support.SCSS (
BpkSkipLink.module.scss)@use '../../bpk-mixins/utils'(no longer needed)@include utils.bpk-themeable-property(...)legacy hooktokens.$bpk-status-danger-spot-day→var(--bpk-status-danger-spot, tokens.$bpk-status-danger-spot-day)tokens.$bpk-text-on-dark-day→var(--bpk-text-on-dark, tokens.$bpk-text-on-dark-day)tokens.$bpk-border-radius-sm→var(--bpk-radius-sm, tokens.$bpk-border-radius-sm)$bpk-duration-smand$bpk-one-pixel-remthemeAttributes
[]— global semantic CSS vars (--bpk-status-danger-spot,--bpk-text-on-dark) are theme-level concerns and not exposed as per-component theme attributesStories (
BpkSkipLink.stories.tsx)DarkModestory usingBpkDarkExampleWrapper