Skip to content

[babel-plugin] Treat initialLetter as a unitless number - #2021

Draft
henryqdineen wants to merge 1 commit into
meta:mainfrom
henryqdineen:hqd-unitless-initial-letter
Draft

henryqdineen wants to merge 1 commit into
meta:mainfrom
henryqdineen:hqd-unitless-initial-letter

Conversation

@henryqdineen

Copy link
Copy Markdown
Collaborator

What changed / motivation ?

initialLetter: 3 compiles to initial-letter:3px, which is invalid CSS, so browsers drop the declaration and the drop cap is ignored. The size argument of initial-letter is a plain <number> (fractional values like 3.5 are allowed), so it should never get a px suffix. This adds initialLetter to unitlessNumberProperties, the same fix as #1903 for fontSizeAdjust.

This is an edge case: the Flow/TS types ('normal' | string) and the eslint valid-styles rule both already reject a numeric initialLetter, so only untyped, unlinted code can hit it. The string forms ('3', '3 2') already work and are unchanged.

Linked PR/Issues

Fixes #2019

Additional Context

Tests: added initialLetter: 3.5 to the existing unitless case in transform-value-normalization-test.js; it now emits initial-letter:3.5.

Pre-flight checklist

🤖 Generated with Claude Code

`initialLetter: 3` compiled to `initial-letter:3px`, which is invalid CSS, so browsers dropped the declaration. The size argument is a plain `<number>`, so it should never get a `px` suffix.

The Flow/TS types and the eslint valid-styles rule already reject numeric `initialLetter`, so this only affects untyped, unlinted code.

Fixes meta#2019

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Nov 8, 2026

Copy link
Copy Markdown

@henryqdineen is attempting to deploy a commit to the Meta Open Source Team on Vercel.

A member of the Team first needs to authorize it.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Nov 8, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[babel-plugin] Numeric initialLetter and columns get px appended

1 participant