Skip to content

fix(theme): temporarily keep native controls in light mode - #3479

Merged
chdefrene merged 2 commits into
mainfrom
chdefrene-theme-native-light-mode
Oct 22, 2026
Merged

chdefrene merged 2 commits into
mainfrom
chdefrene-theme-native-light-mode

Conversation

@chdefrene

@chdefrene chdefrene commented Oct 22, 2026 •

Copy link
Copy Markdown
Member

Component Development

Type

  • Feature
  • Fix
  • Hotfix (should release ASAP)
  • Maintenance (deps only)

Reference to assignment

Related: equinor/fusion-core-tasks#2120 (not closed by this PR).
Supersedes equinor/fusion-web#52 following migration of the theme package. The old PR remains open because fusion-web is archived/read-only.

Description of assignment

Temporarily keep browser-native controls aligned with Fusion's light palette in the relocated @equinor/fusion-web-theme package. Isolate the policy so it can be removed when Fusion supports dark mode.

Description of Proposed Changes

  • Add a standalone color-scheme: only light entry in colorVariables, inherited once by aggregate attributes; preserve all 75 existing color declarations and their order.
  • Add regressions for uniqueness, fixed-snapshot compatibility/order, aggregate composition, and fresh-process DOM-free imports through the built public entry point. Build before running package tests.
  • Document root CSS consumption, startup/body-overlay coverage, and the modern EDS caveat; include a patch changeset.

Importing the package does not inject CSS or mutate DOM/HTML attributes. Consumers must apply the declarations on the document root; protection starts when the stylesheet applies. This protects native controls, not modern EDS token palette selection: color-scheme does not disable prefers-color-scheme, and modern EDS consumers still need data-color-scheme="light" on html. No React provider changes or new legacy token imports.

Validation:

  • bun run --cwd packages/theme test — passed, including build: 4 tests / 1 committed snapshot / 9 assertions. The original regressions failed before the implementation.
  • bun run --cwd packages/theme build — passed.
  • bun run check -- packages/theme — passed, 10 files.
  • git diff --check — passed.
  • Snapshot baseline independently verified against the original declarations at Git revision ddafd28: all 75 declarations and their order match. Mutation checks for reordered, removed, and changed declarations each failed the compatibility test as expected.
  • The committed fresh-process test imports dist/index.js with throwing document/window getters — passed.
  • bun /Users/christian.frene/.copilot/session-state/41fc6c0e-5564-4b54-bccb-99e10e6d1b1c/files/validate-theme-chrome.ts — passed against generated root declarations in isolated Chrome 156.0.8078.48. Initial light → dark → light and initial dark → light → dark retained light-only computed schemes and white native input/select backgrounds, including controls in a body-mounted overlay. Media-query emulation changed correctly; screenshots and JSON evidence are session artifacts. Subsequent review fixes only change tests, the test command, and documentation.

Full monorepo/Storybook and authenticated application validation were not run. Browser checks do not establish modern EDS palette selection or native select popup rendering.

Checklist

Create User Story(DevOps) or Issue(Github)

  • Describe functional requirements
  • Design plan/suggestion (e.g. images, link to eds design or relevant figma links, mention of eds tokens to use)
  • Communication with UX (evaluate if needed)

No new UI design; use a removable CSS declaration only.

Development

  • Describe the component
  • Code funtional requirements
  • Create stories
  • Create snapshots (evaluate if needed)
  • Remove unused imports and commented code
  • Lint code with Biome (and follow best practises for code quality

No Storybook stories added for this declaration-only fix. A fixed legacy-output snapshot is committed; isolated native-control screenshots were inspected separately.

Create Pull Request

  • Assign relevant reviewers in Github and Cromatic
  • Inform colleagues of pending reviews. We use Teams for this purpose, under fusion-frontend team please tag involved reviewers in the Code review channel

GitHub rejected the requested fusion-core-code-reviewers team because it is not a repository collaborator. No permission changes were made.

Review of Pull Request

  • Follow up on comments from code review and implement necessary changes (evaluate if needed)
  • Review approved in github (and chromatic)

Address Copilot's fixed-baseline comment and built-entry validation concern in separate signed review-fix commit 30aac99; reply to and resolve the inline thread.

Publish Code

  • Increment version number
  • Merge PR
  • Consider letting fusion developers know this this shiny new thing exists

Patch changeset included; release automation owns versioning.

Add a removable native color-scheme declaration while preserving legacy theme variables and DOM-free imports. Include focused regressions, root-consumption guidance, and a patch changeset.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI lite review requested due to automatic review settings October 22, 2026 08:40
@changeset-bot

changeset-bot Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 30aac99

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@equinor/fusion-web-theme Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

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.

🟡 Changes recommended

The two moderate test-validation issues must be addressed before approval.

1 open issue
What changed in this PR

This pull request adds a temporary light-only color scheme to @equinor/fusion-web-theme, keeping browser-native controls aligned with Fusion’s light palette while documenting integration limitations.

Changes:

  • Adds color-scheme: only light to the exported color and aggregate declarations.
  • Adds regression tests for declaration composition, ordering, uniqueness, and DOM-free imports.
  • Documents root stylesheet usage and modern EDS limitations.
  • Adds a patch changeset and package test script.
File Summary
packages/​theme/​tests/​colors.test.ts Adds regression coverage; two moderate issues remain because the compatibility check derives its baseline from current declarations and the fresh-process check targets the source entry rather than the published artifact.
packages/​theme/​src/​styles/​colors.ts Adds the temporary light-only native control declaration while preserving existing variables.
packages/​theme/​README.md Documents stylesheet application, scope, and modern EDS limitations.
packages/​theme/​package.json Adds the package test script.
.changeset/​theme-native-light-mode.md Records the patch release and behavior change.

Review effort: Lite

Comment thread packages/theme/tests/colors.test.ts Resolved
Address Copilot feedback with a fixed 75-declaration snapshot verified against the pre-change Git baseline. Build before testing DOM-free imports through the published entry point.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

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.

🟢 Approval recommended

The reviewed changes preserve existing output, add targeted regression coverage, document integration requirements, and have no unresolved blocking issues.

No open issues 🎉

1 resolved since last review

Review effort: Lite

@chdefrene
chdefrene requested a review from a team October 22, 2026 09:09
eikeland
eikeland previously approved these changes Oct 22, 2026
Comment thread packages/theme/package.json Resolved
@chdefrene
chdefrene force-pushed the chdefrene-theme-native-light-mode branch from 2360357 to 30aac99 Compare October 22, 2026 10:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants