Skip to content
This repository was archived by the owner on Aug 5, 2026. It is now read-only.

[CLOV-CSS] Migrate bpk-component-popover to CSS custom properties - #4949

Merged
Vincent Liu (xiaogliu) merged 2 commits into
mainfrom
migrate/css-vars-popover-4844
Jul 23, 2026
Merged

Vincent Liu (xiaogliu) merged 2 commits into
mainfrom
migrate/css-vars-popover-4844

Conversation

@gert-janvercauteren

Copy link
Copy Markdown
Contributor

Summary

  • Migrates bpk-component-popover SCSS to use CSS custom properties with SASS fallbacks
  • Replaces bare tokens.$bpk-color-white and tokens.$bpk-surface-default-day with var(--bpk-surface-default, ...) pattern
  • Wraps spacing tokens (bpk-spacing-base, bpk-spacing-md) with var(--bpk-spacing-*, ...) equivalents
  • Adds dark mode story (VisualTestDark) using BpkDarkExampleWrapper
  • Non-themeable tokens ($bpk-duration-sm, $bpk-duration-xs, $bpk-breakpoint-mobile, $bpk-one-pixel-rem) left as bare SASS tokens — no CSS var equivalent exists
  • themeAttributes.tsx unchanged — correctly delegates to bpk-component-link theme attributes

Closes #4844

🤖 Generated with Claude Code

Copilot AI review requested due to automatic review settings July 22, 2026 08:43

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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-popover styling to CSS custom properties (with SASS fallbacks) and adds a dark-mode visual regression story to validate the new theming behavior.

Changes:

  • Updated popover SCSS tokens to var(--bpk-*, fallback) patterns for surfaces and spacing.
  • Added a VisualTestDark Storybook story using BpkDarkExampleWrapper.

Reviewed changes

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

File Description
packages/backpack-web/src/bpk-component-popover/src/BpkPopover.stories.js Adds a dark-mode visual test story wrapped in BpkDarkExampleWrapper.
packages/backpack-web/src/bpk-component-popover/src/BpkPopover.module.scss Replaces hard-coded surface/spacing tokens with CSS custom properties + SASS fallbacks.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +227 to +233
const DarkExample = () => (
<BpkDarkExampleWrapper>
<Spacer>
<PopoverContainer id="my-popover-dark" isOpen />
</Spacer>
</BpkDarkExampleWrapper>
);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Outdated — this comment refers to a file/section that's no longer part of the current diff (superseded by a later commit on this branch). No action needed here.

const DarkExample = () => (
<BpkDarkExampleWrapper>
<Spacer>
<PopoverContainer id="my-popover-dark" isOpen />

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Outdated — this comment refers to a file/section that's no longer part of the current diff (superseded by a later commit on this branch). No action needed here.

transition: opacity tokens.$bpk-duration-sm ease-in-out;
outline: 0;
background-color: tokens.$bpk-color-white;
background-color: var(--bpk-surface-default, tokens.$bpk-color-white);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Not a bug — $bpk-color-white and $bpk-surface-default-day are both rgb(255,255,255) (#ffffff), so the fallback resolves to the identical colour either way. The fallback only kicks in when var() support is absent, so functionally there's no difference. Agree $bpk-surface-default-day would be the more semantically precise fallback to use going forward, but this isn't a rendering bug.

@skyscanner-backpack-bot

Copy link
Copy Markdown
Contributor

@xiaogliu

Copy link
Copy Markdown
Contributor

Token value audit — verified every new CSS var introduced in this PR against token-sync/css/theme-backpack-light.css / theme-backpack-dark.css and the original SASS token source (base.default.scss):

CSS var Old SASS fallback Light value Dark value Match
--bpk-surface-default $bpk-color-white #ffffff #131d2b ✅
--bpk-surface-default $bpk-surface-default-day #ffffff #131d2b ✅
--bpk-spacing-base $bpk-spacing-base 1rem (no dark override — rem/radius values are theme-agnostic) ✅
--bpk-spacing-md $bpk-spacing-md 0.5rem (no dark override — rem/radius values are theme-agnostic) ✅

All new/old values match — no visual regression risk from this migration.

@xiaogliu Vincent Liu (xiaogliu) left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@xiaogliu
Vincent Liu (xiaogliu) merged commit 96151c2 into main Jul 23, 2026
25 of 27 checks passed
@xiaogliu
Vincent Liu (xiaogliu) deleted the migrate/css-vars-popover-4844 branch July 23, 2026 09:00
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Migrate bpk-component-popover to CSS custom properties

3 participants