Revert "Don't use color-mix(…)
on currentColor
(#17247)" and work around Preflight crash
#17306
+61
−48
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #17194.
This reverts commit d6d913e.
The initial fix does breaks older versions of Chrome (where text won't render with a color for the placeholder at all anymore) and the usage of the relative colors features also means it'll require a much newer version of Safari/Firefox/Chrome to work correctly. The implementation was also wrong as it always set alpha to the specific percent instead of applying it additively (note that this can be fixed with
calc(alpha * opacity)
though).Instead we decided to fix this by adding a
@supports
query to Preflight that only targets browsers that aren't affected by the crash. We currently use the following workaround:Test plan
When testing the
color-mix(currentColor)
vsoklab(from currentColor …)
we created the following support matrix. I'm extending it with our fix which is the fix ended up using:color-mix(… currentColor …)
oklab(from currentColor …)
@supports { color-mix(…) }
Note that on Safari 16, this change makes it so that the browser does not crash yet it still won't work either. That's because now the browser will fall back to the default placeholder color instead. We used the following play to test the fix: https://play.tailwindcss.com/RF1RYbZLKY