Skip to content

fix(react-migration-v8-v9): use webDarkTheme as createV9Theme base for inverted v8 themes - #41

Open
mainframev wants to merge 1 commit into
masterfrom
fix/create-v9-theme-dark-base
Open

mainframev wants to merge 1 commit into
masterfrom
fix/create-v9-theme-dark-base

Conversation

@mainframev

Copy link
Copy Markdown
Owner

Previous Behavior

createV9Theme(themeV8) always fell back to webLightTheme as the base v9 theme. Tokens that have no v8 mapping, such as the colorStatus* tokens, kept their light values even when the v8 theme was dark (isInverted: true). Status colors therefore rendered wrong in dark themes unless the caller passed webDarkTheme explicitly.

New Behavior

When no base theme is passed, createV9Theme uses webDarkTheme for inverted v8 themes and webLightTheme for the rest. An explicitly passed baseThemeV9 still takes precedence.

Before / after for createV9Theme(createTheme({ isInverted: true })).colorStatusDangerForeground1:

Value Source
Before #b10e1c webLightTheme
After #dc626d webDarkTheme

Added v9ThemeShim.test.ts with light, dark, and explicit-base cases. The dark case fails on master and passes with this change.

webDarkTheme is now always bundled with createV9Theme (flagged in microsoft#31743). This package already imports @fluentui/react-components, so the extra cost is one theme object.

This replaces microsoft#31743, which no longer applies after the package moved to library/.

Related Issue(s)

…r inverted v8 themes

createV9Theme always fell back to webLightTheme, so tokens without a v8
mapping (e.g. status colors) kept light values for dark v8 themes.
Fall back to webDarkTheme when themeV8.isInverted is set; an explicit
base theme still wins.

Fixes microsoft#31728

This branch has not been deployed

No deployments
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.

[Bug]: CreateV9Theme cannot support some token in dark theme

1 participant