Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't unset keys like --font-weight-* when unsetting --font-* #14906

Merged
merged 4 commits into from
Nov 7, 2024

Conversation

adamwathan
Copy link
Member

This PR fixes an issue where unsetting --font-* would unset --font-weight-* and --font-size-*.

@theme {
  --font-weight-bold: bold;
  --font-size-sm: 14px;
  --font-sans: sans-serif;
  --font-serif: serif;
}
@theme {
  --font-*: initial;
  --font-body: Inter;
}

Up until now this was sort of intended/desired behavior but with recent changes there are now more overlapping theme keys (--inset-* and --inset-shadow-* as well for example), and we don't want to make it impossible to unset just the default font-family values.

This PR also simplifies how we were handling making sure that the inset-* utility ignored --inset-shadow-* variables since it's all really the same problem.

This does mean we need to maintain a list of known theme keys so we know when there is a conflict between two keys, which is kind of unfortunate because up until now this was a totally dynamic thing. End users can still add whatever custom stuff they want under @theme but we don't really know about those namespaces since we're maintaining a static list so we can't resolve conflicts there. I'm confident there are ways we could solve this if it actually becomes a problem, so content to push forward without solving it right now and just deal with it if/when it actually arises, because it just might not.

@adamwathan adamwathan requested a review from a team as a code owner November 7, 2024 14:41
@adamwathan adamwathan force-pushed the fix/dont-unset-subnamespaces branch from c5e1d5d to 57ddb17 Compare November 7, 2024 14:42
@adamwathan adamwathan merged commit a4f8a36 into next Nov 7, 2024
1 check passed
@adamwathan adamwathan deleted the fix/dont-unset-subnamespaces branch November 7, 2024 15:43
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.

1 participant