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

Use initial for @property fallbacks instead of #13949

Merged
merged 2 commits into from
Jul 4, 2024

Conversation

adamwathan
Copy link
Member

This PR updates the way we generate @property fallbacks for Firefox to use initial instead of for properties that are defined with no initial value:

Before:

@property --tw-gradient-via-stops {
  syntax: "*";
  inherits: false;
}

@supports (-moz-orient: inline) {
 * {
   --tw-gradient-via-stops: ;
 }
}

After:

@property --tw-gradient-via-stops {
  syntax: "*";
  inherits: false;
}

@supports (-moz-orient: inline) {
 * {
   --tw-gradient-via-stops: initial;
 }
}

This is necessary because we have code in our CSS that depends on variables like --tw-gradient-via-stops resolving to an invalid value to trigger a fallback:

.from-red-500 {
  --tw-gradient-from: var(--color-red-500, #ef4444);
  --tw-gradient-stops: var(--tw-gradient-via-stops, var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position));
}

If --tw-gradient-via-stops resolves to , then --tw-gradient-stops will also resolve to instead of falling back to the fallback value, which prevents 2-stop gradients from working in Firefox at the moment.

Fixes #13948.

@adamwathan adamwathan merged commit 407de01 into next Jul 4, 2024
1 check passed
@adamwathan adamwathan deleted the use-initial-for-property-fallbacks branch July 4, 2024 15:20
@adamwathan adamwathan restored the use-initial-for-property-fallbacks branch July 4, 2024 15:20
@adamwathan adamwathan deleted the use-initial-for-property-fallbacks branch July 4, 2024 15:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants