Workaround Chrome rendering bug for skew-*
utilities
#17627
Merged
+104
−138
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 #17621
Chrome as a pretty ugly rendering glitch when using a
skew-*
utility in Tailwind 4: https://play.tailwindcss.com/HuiZtbrHOcThe was not an issue in v3 since transforms were set up in a different way. Without the
var(…)
syntax, the difference boils down to this:It appears that using any of the single-dimension rotate functions will cause the Chrome rendering to glitch.
After doing some digging, we found that initially these
@property
s were defined as type<transform-function>
and later changed to*
. With a type of*
, it makes sense that the initial value of these variables can default toinitial
without any compromises, allowing us to default to something like this now:Tested this change in the latest version of Chrome (135) and it does make the rendering glitch in the initial issue disappear. By using the
var(--tw-rotate-x,)
syntax we also ensure this works on older versions of Safari (tested on Safari 15.5 and 16.4).Note, however, that there are still glitches happening when you combine rotate and skew in the latest version of Chrome or when you transition the
skew(…)
variable. This also happens in plain CSS with no variables though, so there isn't something we can do about this: https://play.tailwindcss.com/g3FXPEJHpnTest plan