Skip to content

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
@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

Development

Successfully merging this pull request may close these issues.

Gradients do not work in Firefox in v4.0.0-alpha.16, potentially caused by special @supports (-moz-orient: inline) selector

3 participants