Skip to content

Conversation

@adamwathan
Copy link
Member

@adamwathan adamwathan commented Nov 27, 2024

Safari has an insane bug where if you register custom properties for gradient colors using the "<color>" type, you attempt to transition a gradient on an element, and you set a font-size and line-height on that element that point to CSS variables defined using rem units, the element size changes and shifts the layout while the transition is happening:

Untitled.mov

This bug goes away if you use anything other than rem units for the line-height. So this PR changes all of our variables like --text-3xl--line-height to use unitless relative line-height values instead of fixed line-height values to workaround this bug. Not my favorite change but pretty low impact because you likely aren't going to reference those variables for much anyways.

If Safari ever fixes this bug (which is still present as of Safari 18), it would be nice to swap these back to what they were.

Fixes #15196.

@adamwathan adamwathan requested a review from a team as a code owner November 27, 2024 16:29
@adamwathan adamwathan merged commit aa15964 into next Nov 27, 2024
1 check passed
@adamwathan adamwathan deleted the fix/use-unitless-line-heights-for-font-size-variables branch November 27, 2024 16:39
@barvian
Copy link
Contributor

barvian commented Nov 27, 2024

👋 Nice! Just out of curiosity, why were some line heights unitless and others rem? I never understood the distinction.

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.

[v4] Transitions with active pseudo class increases unexpected margin in Safari when combined with a font size class

4 participants