Skip to content

Workaround Chrome rendering bug for skew-* utilities#17627

Merged
philipp-spiess merged 2 commits intomainfrom
fix/chrome-skew-bug
Apr 11, 2025
Merged

Workaround Chrome rendering bug for skew-* utilities#17627
philipp-spiess merged 2 commits intomainfrom
fix/chrome-skew-bug

Conversation

@philipp-spiess
Copy link
Contributor

Closes #17621

Chrome as a pretty ugly rendering glitch when using a skew-* utility in Tailwind 4: https://play.tailwindcss.com/HuiZtbrHOc

The 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:

.skew-v3 {
  transform: rotate(0) skewX(-20deg);
}

.skew-v4 {
  transform: rotateX(0) rotateY(0) rotateZ(0) skewX(-20deg);
}

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 @propertys 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 to initial without any compromises, allowing us to default to something like this now:

.skew-new {
  transform: skewX(-20deg);
}

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/g3FXPEJHpn

Test plan

  • Tested on latest Chrome, Firefox, and Safari as well as Safari 15.5 and 16.4.
Screenshot 2025-04-09 at 18 01 51

@philipp-spiess philipp-spiess requested a review from a team as a code owner April 9, 2025 16:19
@philipp-spiess philipp-spiess merged commit 6e1f533 into main Apr 11, 2025
7 checks passed
@philipp-spiess philipp-spiess deleted the fix/chrome-skew-bug branch April 11, 2025 14:38
vaernion pushed a commit to Arbeidstilsynet/brevgen2 that referenced this pull request Dec 3, 2025
…patch)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [@tailwindcss/postcss](https://tailwindcss.com) ([source](https://github.com/tailwindlabs/tailwindcss/tree/HEAD/packages/@tailwindcss-postcss)) | [`4.1.3` -> `4.1.4`](https://renovatebot.com/diffs/npm/@tailwindcss%2fpostcss/4.1.3/4.1.4) | [![age](https://developer.mend.io/api/mc/badges/age/npm/@tailwindcss%2fpostcss/4.1.4?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@tailwindcss%2fpostcss/4.1.4?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@tailwindcss%2fpostcss/4.1.3/4.1.4?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@tailwindcss%2fpostcss/4.1.3/4.1.4?slim=true)](https://docs.renovatebot.com/merge-confidence/) |
| [tailwindcss](https://tailwindcss.com) ([source](https://github.com/tailwindlabs/tailwindcss/tree/HEAD/packages/tailwindcss)) | [`4.1.3` -> `4.1.4`](https://renovatebot.com/diffs/npm/tailwindcss/4.1.3/4.1.4) | [![age](https://developer.mend.io/api/mc/badges/age/npm/tailwindcss/4.1.4?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/tailwindcss/4.1.4?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/tailwindcss/4.1.3/4.1.4?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/tailwindcss/4.1.3/4.1.4?slim=true)](https://docs.renovatebot.com/merge-confidence/) |

---

### Release Notes

<details>
<summary>tailwindlabs/tailwindcss (@&#8203;tailwindcss/postcss)</summary>

### [`v4.1.4`](https://github.com/tailwindlabs/tailwindcss/blob/HEAD/CHANGELOG.md#414---2025-04-14)

[Compare Source](tailwindlabs/tailwindcss@v4.1.3...v4.1.4)

##### Added

-   Add experimental `@tailwindcss/oxide-wasm32-wasi` target for running Tailwind in browser environments like StackBlitz ([#&#8203;17558](tailwindlabs/tailwindcss#17558))

##### Fixed

-   Ensure `color-mix(…)` polyfills do not cause used CSS variables to be removed ([#&#8203;17555](tailwindlabs/tailwindcss#17555))
-   Ensure `color-mix(…)` polyfills create fallbacks for theme variables that reference other theme variables ([#&#8203;17562](tailwindlabs/tailwindcss#17562))
-   Fix brace expansion in declining ranges like `{10..0..5}` and `{0..10..-5}` ([#&#8203;17591](tailwindlabs/tailwindcss#17591))
-   Work around a Chrome rendering bug when using the `skew-*` utilities ([#&#8203;17627](tailwindlabs/tailwindcss#17627))
-   Ensure container quer...
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.

2 participants