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

[CLOV-CSS] Migrate bpk-component-tooltip to CSS custom properties - #4933

Merged
Vincent Liu (xiaogliu) merged 3 commits into
mainfrom
migrate/css-vars-tooltip-4813
Jul 23, 2026
Merged

Vincent Liu (xiaogliu) merged 3 commits into
mainfrom
migrate/css-vars-tooltip-4813

Conversation

@gert-janvercauteren

Copy link
Copy Markdown
Contributor

Closes #4813

Changes

Migrates bpk-component-tooltip SCSS to use CSS custom properties with SASS token fallbacks, enabling light/dark mode theming via the CSS var system.

Token migrations

SASS token CSS custom property
tokens.$bpk-surface-contrast-day var(--bpk-surface-contrast, ...)
tokens.$bpk-surface-default-day var(--bpk-surface-default, ...)
tokens.$bpk-text-primary-inverse-day var(--bpk-text-inverse, ...)

Gap tokens (annotated, no CSS var equivalent)

  • tokens.$bpk-zindex-tooltip — /* gap: z-index, not in token-sync */
  • tokens.$bpk-duration-sm — /* gap: animation duration */

Story additions

  • Added VisualTestDark story using BpkDarkExampleWrapper to verify dark mode rendering

No themeAttributes.tsx changes required.

Co-Authored-By: Claude Sonnet 4.6 (1M context) [email protected]

Replaces bare SASS tokens with var() + SASS fallback pattern:
- $bpk-surface-contrast-day → var(--bpk-surface-contrast, ...)
- $bpk-surface-default-day → var(--bpk-surface-default, ...)
- $bpk-text-primary-inverse-day → var(--bpk-text-inverse, ...)

Gap tokens annotated with comments (z-index, animation duration).
Adds VisualTestDark story using BpkDarkExampleWrapper.

Closes #4813

Co-Authored-By: Claude Sonnet 4.6 (1M context) <[email protected]>
Copilot AI review requested due to automatic review settings July 22, 2026 07:58

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-tooltip styles to use CSS custom properties (with SASS token fallbacks) and adds a Storybook story to visually validate dark-mode theming.

Changes:

  • Replace several tooltip SCSS token usages with CSS custom properties + SASS fallbacks.
  • Annotate remaining “gap” tokens that have no CSS var equivalent.
  • Add a new VisualTestDark Storybook story wrapped in BpkDarkExampleWrapper.

Reviewed changes

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

File Description
packages/backpack-web/src/bpk-component-tooltip/src/BpkTooltip.stories.tsx Adds a dark-mode visual regression story using BpkDarkExampleWrapper.
packages/backpack-web/src/bpk-component-tooltip/src/BpkTooltip.module.scss Switches selected tooltip colors to CSS custom properties with SASS fallbacks and annotates gaps.

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

Comment on lines +210 to +214
<BpkTooltip
ariaLabel="Montréal-Trudeau International Airport"
id="my-tooltip-dark"
type={TOOLTIP_TYPES.dark}
target={

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.

Comment on lines +207 to +225
const VisualTestDarkExample = () => (
<BpkDarkExampleWrapper>
<div style={wrapperStyle}>
<BpkTooltip
ariaLabel="Montréal-Trudeau International Airport"
id="my-tooltip-dark"
type={TOOLTIP_TYPES.dark}
target={
<div>
<Heading>YUL</Heading>
</div>
}
isOpen
>
Montréal-Trudeau International Airport
</BpkTooltip>
</div>
</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.

@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-contrast $bpk-surface-contrast-day #05203c #010913 ✅
--bpk-surface-default $bpk-surface-default-day #ffffff #131d2b ✅
--bpk-text-inverse $bpk-text-primary-inverse-day #ffffff #010913 ✅

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 b186671 into main Jul 23, 2026
25 of 27 checks passed
@xiaogliu
Vincent Liu (xiaogliu) deleted the migrate/css-vars-tooltip-4813 branch July 23, 2026 08:55
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-tooltip to CSS custom properties

3 participants