Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use unitless line-heights for font-size variables #15216

Merged

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
3 participants