Repository navigation
fix(storybook): keep EDS-styled previews light - #3438
Conversation
|
There was a problem hiding this comment.
🟢 Approval recommended
The scoped changes match the stated policy, and the reported meta-value issue is not valid.
0 open findings
What changed in this PR
This PR temporarily keeps Storybook’s preview and manager light without changing reusable components or providers.
Changes:
- Apply light color-scheme settings before preview content renders and throughout manager controls.
- Add startup regression tests and document the temporary policy and browser checks.
| File | Description |
|---|---|
storybook/package.json |
Adds the test command. |
storybook/.storybook/preview-head.html |
Sets the preview’s light scheme at startup. |
storybook/.storybook/manager-head.html |
Keeps manager controls light. |
storybook/.storybook/light-mode.test.mjs |
Checks the startup settings. |
CONTRIBUTING.md |
Documents the policy and verification steps. |
🧠 Review effort: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
Closing per maintainer decision for equinor/fusion-core-tasks#2120: the temporary light-mode override now lives only in |
0d88d2b to
0e6a61b
Compare
Set data-color-scheme="light" on the Storybook preview root via preview-head.html, following EDS colour scheme guidance, so EDS v2 CSS variables and native controls stay light regardless of prefers-color-scheme. Precautionary: the preview does not load EDS v2 variables yet. The manager UI is unchanged. Adds Playwright-backed node:test regression tests, docs, and a changeset. Refs equinor/fusion-core-tasks#2120 Refs equinor/fusion-react-components#3438 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
ce92348 to
751a71b
Compare
751a71b to
0307cbb
Compare
0307cbb to
0cbf30b
Compare
543789a to
a3f96fe
Compare
Port the light-mode regression tests from node:test to vitest with a storybook vitest config, matching equinor/fusion-react-components#3438. Refs equinor/fusion-core-tasks#2120 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Set data-color-scheme="light" on the Storybook preview root via preview-head.html, following EDS colour scheme guidance, so EDS v2 CSS variables and native controls stay light regardless of prefers-color-scheme. Precautionary: the preview does not load EDS v2 variables yet. The manager UI is unchanged. Adds Playwright-backed node:test regression tests, docs, and a changeset. Refs equinor/fusion-core-tasks#2120 Refs equinor/fusion-react-components#3438 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Port the light-mode regression tests from node:test to vitest with a storybook vitest config, matching equinor/fusion-react-components#3438. Refs equinor/fusion-core-tasks#2120 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Port the light-mode regression tests from node:test to vitest with a storybook vitest config, matching equinor/fusion-react-components#3438. Refs equinor/fusion-core-tasks#2120 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
62ab69a to
b85d036
Compare
Set data-color-scheme="light" on the Storybook preview root via preview-head.html, following EDS colour scheme guidance, so EDS v2 CSS variables and native controls stay light regardless of prefers-color-scheme. Precautionary: the preview does not load EDS v2 variables yet. The manager UI is unchanged. Adds Playwright-backed node:test regression tests, docs, and a changeset. Refs equinor/fusion-core-tasks#2120 Refs equinor/fusion-react-components#3438 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Port the light-mode regression tests from node:test to vitest with a storybook vitest config, matching equinor/fusion-react-components#3438. Refs equinor/fusion-core-tasks#2120 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Set data-color-scheme="light" on the Storybook preview root via preview-head.html, following EDS colour scheme guidance, so EDS v2 CSS variables and native controls stay light regardless of prefers-color-scheme. Precautionary: the preview does not load EDS v2 variables yet. The manager UI is unchanged. Adds Playwright-backed node:test regression tests, docs, and a changeset. Refs equinor/fusion-core-tasks#2120 Refs equinor/fusion-react-components#3438 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Port the light-mode regression tests from node:test to vitest with a storybook vitest config, matching equinor/fusion-react-components#3438. Refs equinor/fusion-core-tasks#2120 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Set data-color-scheme="light" on the Storybook preview root via preview-head.html, following EDS colour scheme guidance, so EDS v2 CSS variables and native controls stay light regardless of prefers-color-scheme. Precautionary: the preview does not load EDS v2 variables yet. The manager UI is unchanged. Adds Playwright-backed node:test regression tests, docs, and a changeset. Refs equinor/fusion-core-tasks#2120 Refs equinor/fusion-react-components#3438 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Port the light-mode regression tests from node:test to vitest with a storybook vitest config, matching equinor/fusion-react-components#3438. Refs equinor/fusion-core-tasks#2120 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Set data-color-scheme="light" on the Storybook preview root via preview-head.html, following EDS colour scheme guidance, so EDS v2 CSS variables and native controls stay light regardless of prefers-color-scheme. Precautionary: the preview does not load EDS v2 variables yet. The manager UI is unchanged. Adds Playwright-backed node:test regression tests, docs, and a changeset. Refs equinor/fusion-core-tasks#2120 Refs equinor/fusion-react-components#3438 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Port the light-mode regression tests from node:test to vitest with a storybook vitest config, matching equinor/fusion-react-components#3438. Refs equinor/fusion-core-tasks#2120 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Set data-color-scheme="light" on the Storybook preview root via preview-head.html, following EDS colour scheme guidance, so EDS v2 CSS variables and native controls stay light regardless of prefers-color-scheme. Precautionary: the preview does not load EDS v2 variables yet. The manager UI is unchanged. Adds Playwright-backed node:test regression tests, docs, and a changeset. Refs equinor/fusion-core-tasks#2120 Refs equinor/fusion-react-components#3438 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Port the light-mode regression tests from node:test to vitest with a storybook vitest config, matching equinor/fusion-react-components#3438. Refs equinor/fusion-core-tasks#2120 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
2b7fa7c to
7cdbd55
Compare
Follow EDS colour scheme detection guidance by declaring <html data-color-scheme="light"> in the Storybook preview head, so EDS CSS variables and native controls stay light regardless of the OS preference. The Storybook manager UI is left unchanged. Add node:test + Playwright regression tests asserting that --eds-color-bg-canvas renders the EDS light token value under a dark prefers-color-scheme, and document the temporary policy in CONTRIBUTING.md. Refs equinor/fusion-core-tasks#2120 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Port the light-mode regression tests from node:test to vitest, matching the test runner used elsewhere in the repository. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
The Theme decorator renders <fwc-theme>, which already injects the Equinor font stylesheet into the document head on connect. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
e7807fe to
c3c33ae
Compare
Component Development
Type
Reference to assignment
Related to equinor/fusion-core-tasks#2120, Storybook portion only. Other runtime surfaces are handled separately. This is a nonclosing reference; legacy work remains unresolved.
Description of assignment
This is a separate fix needed specifically for Storybook. The theme fix in #3479 keeps native controls light for components using the shared theme, but it does not cover the Storybook preview document root where EDS CSS variables are resolved. This PR closes that gap for Storybook only.
Temporarily keep Storybook stories and docs that use EDS CSS variables and native browser controls light, both at initial light/dark OS/browser preferences and when preferences change live. Do not add dark-mode support or change reusable component/provider defaults.
Description of Proposed Changes
storybook/.storybook/preview-head.html: declare<html data-color-scheme="light">. The HTML parser merges these attributes onto the preview document's root<html>element before styles load and stories render; no script is needed. EDS then keeps its light variables (itsprefers-color-scheme: darkrule only applies to:root:not([data-color-scheme="light"])) and appliescolor-scheme: light, so native controls stay light too. This covers Docs canvases and body-portaled content without changingThemeProvider.storybook/.storybook/light-mode.test.ts(configured bystorybook/vitest.config.ts): one checks the preview head markup; the other renders--eds-color-bg-canvasin headless Chromium (Playwright, new Storybook dev dependency) with a darkprefers-color-schemeand asserts it resolves to the EDS light token value (bg-neutral-canvas, read from@equinor/eds-tokens) with the preview head, and to the dark value without it. Wire them throughstorybook/package.json(test, plustest:setupto install the browser), and document the temporary policy and verification procedure inCONTRIBUTING.md.Preserve explicit nested dark specimens. Do not change SideSheet or any reusable library.
Changeset: N/A — user-approved private-only exemption (2026-09-30). The user explicitly selected “Exempt the private-only Storybook PR (Recommended)” after reviewing the release-planner evidence. The only affected package is
@equinor/fusion-react-components-stories(storybook/package.json,private: true); contributor documentation is also updated. Existing Changesets configuration defaults toprivatePackages.version: false, and the installed release planner returns no releases for a private Storybook patch entry. Such an entry would be inert. Do not change the repository's private-versioning policy, bump untouched public libraries, or add an empty/inert changeset. No package version bump is included.Follow-up (EDS alignment): verified in Chromium (dev server and
storybook buildoutput) withprefers-color-scheme: darkon load and after a live light→dark switch ondata-textarea--basicanddata-textarea--docs. Preview rootdata-color-scheme="light", computedcolor-scheme: lighton the root, body-portaled input and all 23 Docs controls,--eds-color-bg-canvas#f5f5f5,--eds-color-text-strong#1d1d1d.bun run --cwd storybook testpassed (1 test).Validation completed in the dedicated worktree:
bun install --frozen-lockfilebun run buildbun run --cwd storybook testdata-color-schemeattribute makes both fail.bun run storybook:build --disable-telemetrygit diff --checkRebased onto
mainafter #3486 merged (it removed the merge-conflict markers that #3475 left inbun.lock). This PR's lockfile diff is onlyplaywright/playwright-core. After rebase,bun install --frozen-lockfilereports no changes andbun run --cwd storybook testpasses (2 tests).|
bun run check -- storybook/.storybook/light-mode.test.ts| No files processed: the repository intentionally excludes Storybook from Biome; not a lint pass. ||
node /Users/christian.frene/.copilot/session-state/490877d1-0c04-4928-851e-8d83283486ea/files/storybook-browser.mjs| Passed 15 actual-Storybook Chromium scenarios; no runtime exceptions. |Automated browser evidence covers initial light/dark preferences and live transitions on a textarea story and Docs canvas, native/shadow-DOM controls, and an existing body-portaled EDS tooltip. The EDS input token stays
#f5f5f5; removing the root selector under dark preference reproduces#0b0b0b. An explicit nested dark specimen remains dark.Local evidence is retained in
/Users/christian.frene/.copilot/session-state/490877d1-0c04-4928-851e-8d83283486ea/files/, includingstorybook-browser.json, build logs, and light/dark screenshots. The dependency-free browser harness is a local artifact rather than new repository tooling. Browser coverage is Chromium-only against development Storybook; the production build was checked separately.User-reported manual acceptance (2026-09-30):
The user checked http://127.0.0.1:46123/?path=/story/data-textarea--basic and http://127.0.0.1:46123/?path=/docs/data-textarea--docs. Contents and textarea stayed light after light/dark reloads and live switching. This is a pass for those checked routes and surfaces only, not every story. It is separate from the automated browser/probe results above; no user browser/version or manual portal-specimen check was reported. The report is retained in the local
manual-evidence.mdartifact.Review follow-up: ported the light-mode tests from
node:testto vitest (62ab69a) to match the repository's test runner.bun run --cwd storybook testpassed (2 tests); settingdata-color-scheme="auto"makes both fail.Checklist
Create User Story(DevOps) or Issue(Github)
No new visual design is introduced; the change preserves the existing light appearance.
Development
Reuse existing stories rather than add a new component or story. Local verification screenshots are retained, but no snapshot baselines are added. Biome excludes Storybook; see the validation result above.
Create Pull Request
Create a ready-for-review PR under the user's explicit authorization. Leave assignees unset; no reviewer assignment, merge, deployment, or issue closure is part of this change.
Review of Pull Request
Publish Code
Version increment: N/A under the explicit user-approved private-only changeset exemption above.