Skip to content

Commit c5a0b54

Browse files
authored
Use configured letter-spacing values for custom font-size utilities (#15099)
Fixes #15096. We were mistakenly reading from the `--tracking` sub-property but should be reading from `--letter-spacing`. To test this I copied the reproduction from the issue into our Vite playground and made sure the custom letter-spacing was being applied as expected: <img width="1443" alt="image" src="https://github.com/user-attachments/assets/bfc9ca23-bfc7-40d4-aec0-d3e715312eac"> --------- Co-authored-by: Adam Wathan <[email protected]>
1 parent 5e4f565 commit c5a0b54

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10-
- Nothing yet!
10+
### Fixed
11+
12+
- Use configured `--letter-spacing` values for custom font size utilities ([#15099](https://github.com/tailwindlabs/tailwindcss/pull/15099))
1113

1214
## [4.0.0-beta.1] - 2024-11-21
1315

packages/tailwindcss/src/utilities.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4033,7 +4033,7 @@ export function createUtilities(theme: Theme) {
40334033
let value = theme.resolveWith(
40344034
candidate.value.value,
40354035
['--text'],
4036-
['--line-height', '--tracking', '--font-weight'],
4036+
['--line-height', '--letter-spacing', '--font-weight'],
40374037
)
40384038
if (value) {
40394039
let [fontSize, options = {}] = Array.isArray(value) ? value : [value]
@@ -4067,7 +4067,9 @@ export function createUtilities(theme: Theme) {
40674067
),
40684068
decl(
40694069
'letter-spacing',
4070-
options['--tracking'] ? `var(--tw-tracking, ${options['--tracking']})` : undefined,
4070+
options['--letter-spacing']
4071+
? `var(--tw-tracking, ${options['--letter-spacing']})`
4072+
: undefined,
40714073
),
40724074
decl(
40734075
'font-weight',

packages/tailwindcss/tests/ui.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -568,8 +568,8 @@ test('explicit tracking utilities are respected when overriding font-size', asyn
568568
`,
569569
css`
570570
@theme {
571-
--text-sm--tracking: 5px;
572-
--text-xl--tracking: 10px;
571+
--text-sm--letter-spacing: 5px;
572+
--text-xl--letter-spacing: 10px;
573573
--tracking-tight: 1px;
574574
}
575575
`,

0 commit comments

Comments
 (0)