Skip to content

Conversation

@TrevorBurnham
Copy link

Fixes cloudscape-design/components#4111

#130 introduced a bug where the resolveToken function returned CSS variables for any token that existed in propertiesMap, including regular token-to-token references like colorBackgroundTableHeadercolorBackgroundContainerHeader. This caused both light and dark modes to resolve to the same CSS variable string (e.g., var(--color-background-container-header)), so the difference() function couldn't detect any difference between modes and didn't generate dark mode overrides.

The fix restricts CSS variable resolution to only reference tokens (palette tokens like colorPrimary500) by using isReferenceToken() instead of checking token existence. This allows regular token references to continue resolving recursively to their actual values, enabling proper light/dark mode comparison and override generation.

cc @jkuelz

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

The resolveToken function was returning CSS variables for any token
that existed in propertiesMap, including regular token-to-token
references like colorBackgroundTableHeader → colorBackgroundContainerHeader.

This caused both light and dark modes to resolve to the same CSS
variable string (e.g., var(--color-background-container-header)),
so the difference() function couldn't detect any difference between
modes and didn't generate dark mode overrides.

The fix restricts CSS variable resolution to only reference tokens
(palette tokens like colorPrimary500) by using isReferenceToken()
instead of checking token existence. This allows regular token
references to continue resolving recursively to their actual values,
enabling proper light/dark mode comparison and override generation.
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]: Table header not respecting container-level dark mode

1 participant