Use unitless line-heights for font-size variables (#15216)
Safari has an [insane bug](https://github.com/tailwindlabs/tailwindcss/issues/15196) 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: https://github.com/user-attachments/assets/46eefccf-8a12-4751-8a44-54e48c54cd06 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. --------- Co-authored-by: Adam Wathan <4323180+adamwathan@users.noreply.github.com>
This commit is contained in:
parent
31cfbc7669
commit
aa15964b28
4 changed files with 26 additions and 24 deletions
|
|
@ -19,11 +19,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
- Ensure `--spacing-*` variables take precedence over `--container-*` variables ([#15180](https://github.com/tailwindlabs/tailwindcss/pull/15180))
|
||||
- Fix scanning classes delimited by tab characters ([#15169](https://github.com/tailwindlabs/tailwindcss/pull/15169))
|
||||
- Ensure opacity modifiers and semi-transparent gradients render correctly by default in Safari ([#15201](https://github.com/tailwindlabs/tailwindcss/pull/15201))
|
||||
- Fix element size thrashing when transitioning gradients on elements with a defined font-size in Safari ([#15216](https://github.com/tailwindlabs/tailwindcss/pull/15216))
|
||||
|
||||
### Changed
|
||||
|
||||
- Interpolate gradients using OKLAB instead of OKLCH by default ([#15201](https://github.com/tailwindlabs/tailwindcss/pull/15201))
|
||||
- Error when `layer(…)` in `@import` is not first in the list of functions/conditions ([#15109](https://github.com/tailwindlabs/tailwindcss/pull/15109))
|
||||
- Use unitless line-height values for font-size variables in default theme ([#15216](https://github.com/tailwindlabs/tailwindcss/pull/15216))
|
||||
|
||||
## [4.0.0-beta.2] - 2024-11-22
|
||||
|
||||
|
|
|
|||
|
|
@ -271,21 +271,21 @@ exports[`\`@import 'tailwindcss'\` is replaced with the generated CSS 1`] = `
|
|||
--container-7xl: 80rem;
|
||||
--container-prose: 65ch;
|
||||
--text-xs: .75rem;
|
||||
--text-xs--line-height: 1rem;
|
||||
--text-xs--line-height: calc(1 / .75);
|
||||
--text-sm: .875rem;
|
||||
--text-sm--line-height: 1.25rem;
|
||||
--text-sm--line-height: calc(1.25 / .875);
|
||||
--text-base: 1rem;
|
||||
--text-base--line-height: 1.5rem;
|
||||
--text-base--line-height: calc(1.5 / 1);
|
||||
--text-lg: 1.125rem;
|
||||
--text-lg--line-height: 1.75rem;
|
||||
--text-lg--line-height: calc(1.75 / 1.125);
|
||||
--text-xl: 1.25rem;
|
||||
--text-xl--line-height: 1.75rem;
|
||||
--text-xl--line-height: calc(1.75 / 1.25);
|
||||
--text-2xl: 1.5rem;
|
||||
--text-2xl--line-height: 2rem;
|
||||
--text-2xl--line-height: calc(2 / 1.5);
|
||||
--text-3xl: 1.875rem;
|
||||
--text-3xl--line-height: 2.25rem;
|
||||
--text-3xl--line-height: calc(2.25 / 1.875);
|
||||
--text-4xl: 2.25rem;
|
||||
--text-4xl--line-height: 2.5rem;
|
||||
--text-4xl--line-height: calc(2.5 / 2.25);
|
||||
--text-5xl: 3rem;
|
||||
--text-5xl--line-height: 1;
|
||||
--text-6xl: 3.75rem;
|
||||
|
|
|
|||
|
|
@ -270,21 +270,21 @@ exports[`compiling CSS > \`@tailwind utilities\` is replaced by utilities using
|
|||
--container-7xl: 80rem;
|
||||
--container-prose: 65ch;
|
||||
--text-xs: .75rem;
|
||||
--text-xs--line-height: 1rem;
|
||||
--text-xs--line-height: calc(1 / .75);
|
||||
--text-sm: .875rem;
|
||||
--text-sm--line-height: 1.25rem;
|
||||
--text-sm--line-height: calc(1.25 / .875);
|
||||
--text-base: 1rem;
|
||||
--text-base--line-height: 1.5rem;
|
||||
--text-base--line-height: calc(1.5 / 1);
|
||||
--text-lg: 1.125rem;
|
||||
--text-lg--line-height: 1.75rem;
|
||||
--text-lg--line-height: calc(1.75 / 1.125);
|
||||
--text-xl: 1.25rem;
|
||||
--text-xl--line-height: 1.75rem;
|
||||
--text-xl--line-height: calc(1.75 / 1.25);
|
||||
--text-2xl: 1.5rem;
|
||||
--text-2xl--line-height: 2rem;
|
||||
--text-2xl--line-height: calc(2 / 1.5);
|
||||
--text-3xl: 1.875rem;
|
||||
--text-3xl--line-height: 2.25rem;
|
||||
--text-3xl--line-height: calc(2.25 / 1.875);
|
||||
--text-4xl: 2.25rem;
|
||||
--text-4xl--line-height: 2.5rem;
|
||||
--text-4xl--line-height: calc(2.5 / 2.25);
|
||||
--text-5xl: 3rem;
|
||||
--text-5xl--line-height: 1;
|
||||
--text-6xl: 3.75rem;
|
||||
|
|
|
|||
|
|
@ -296,21 +296,21 @@
|
|||
--container-prose: 65ch;
|
||||
|
||||
--text-xs: 0.75rem;
|
||||
--text-xs--line-height: 1rem;
|
||||
--text-xs--line-height: calc(1 / 0.75);
|
||||
--text-sm: 0.875rem;
|
||||
--text-sm--line-height: 1.25rem;
|
||||
--text-sm--line-height: calc(1.25 / 0.875);
|
||||
--text-base: 1rem;
|
||||
--text-base--line-height: 1.5rem;
|
||||
--text-base--line-height: calc(1.5 / 1);
|
||||
--text-lg: 1.125rem;
|
||||
--text-lg--line-height: 1.75rem;
|
||||
--text-lg--line-height: calc(1.75 / 1.125);
|
||||
--text-xl: 1.25rem;
|
||||
--text-xl--line-height: 1.75rem;
|
||||
--text-xl--line-height: calc(1.75 / 1.25);
|
||||
--text-2xl: 1.5rem;
|
||||
--text-2xl--line-height: 2rem;
|
||||
--text-2xl--line-height: calc(2 / 1.5);
|
||||
--text-3xl: 1.875rem;
|
||||
--text-3xl--line-height: 2.25rem;
|
||||
--text-3xl--line-height: calc(2.25 / 1.875);
|
||||
--text-4xl: 2.25rem;
|
||||
--text-4xl--line-height: 2.5rem;
|
||||
--text-4xl--line-height: calc(2.5 / 2.25);
|
||||
--text-5xl: 3rem;
|
||||
--text-5xl--line-height: 1;
|
||||
--text-6xl: 3.75rem;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue