Skip to content

fix: treat fontSizeAdjust, initialLetter, mathDepth, shapeImageThreshold as unitless (#5871) - #5872

Merged
quantizor merged 2 commits into
styled-components:mainfrom
EnesKartal:fix-unitless-css-properties
Nov 24, 2026
Merged

quantizor merged 2 commits into
styled-components:mainfrom
EnesKartal:fix-unitless-css-properties

Conversation

@EnesKartal

Copy link
Copy Markdown
Contributor

Summary

Adds fontSizeAdjust, initialLetter, mathDepth, and shapeImageThreshold to the unitless CSS property set in packages/styled-components/src/utils/addUnitIfNeeded.ts.

Closes #5871

Changes

  • Updated unitless Set with the 4 standard unitless CSS properties.
  • Added test coverage in packages/styled-components/src/utils/test/addUnitIfNeeded.test.ts.
  • Added changeset patch for @styled-components.

Verification

  • pnpx jest src/utils/test/addUnitIfNeeded.test.ts -c jest.config.main.js -> 4/4 passing
  • pnpm --filter styled-components typecheck -> clean
  • pnpm format:check (biome ci) -> clean

@changeset-bot

changeset-bot Bot commented Nov 8, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 8ca2ee4

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
styled-components Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ No critical issues — three minor suggestions inline.

Reviewed changes — one commit expanding the object-style unitless set, with a unit test and a changeset. All four properties accept a bare number in their current specs, and the shared native path compiles to the same value before and after.

  • Unitless set — fontSizeAdjust, initialLetter, mathDepth, and shapeImageThreshold now emit without px for numeric object-style values.
  • Tests — four assertions added to the existing "does not add a px prefix for unitless properties" case.
  • Changeset — patch entry for styled-components documenting the four properties.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using deepseek-v4.1-flash-1017 (free via Pullfrog for OSS) | 𝕏

Comment thread .changeset/unitless-css-properties.md Resolved
Also quote each property's spec Value line above its test and note the class name change in the changeset.
@EnesKartal

EnesKartal commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor Author

Pushed 8ca2ee4: added hyphenateLimitChars and the maskBorderOutset/maskBorderSlice/maskBorderWidth aliases, quoted each property's current spec Value line above its assertion, and added the class-name note to the changeset.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes — the delta since the prior pullfrog review (9292102a): the unitless set picked up the remaining same-class properties, and the new assertions gained normative citations.

  • Expanded unitless set — hyphenateLimitChars and the maskBorderOutset / maskBorderSlice / maskBorderWidth aliases of borderImage* join the four original properties, with the file docblock updated to match.
  • Spec-quoted tests — a dedicated case quotes each property's current Value: line (MathML Core for math-depth) and asserts the bare number survives, matching the citation style already used for grid-area / line-clamp.
  • Changeset — the entry lists all eight properties and notes that affected components get a new class name on upgrade.

Re-fetched css-text-4 and css-masking-1 to confirm the new quotes, ran addUnitIfNeeded.test.ts (5/5 passing), and checked both changed source files with Biome; all clean. The native path still compiles to the same value because native/transform/units.ts accepts an optional px and none of these properties has a native transform or polyfill.

ℹ️ GitHub took this as a comment because it requires explicit repository access to approve or block a pull request here.

Pullfrog  | View workflow run | Using deepseek-v4.1-flash-1017 (free via Pullfrog for OSS) | 𝕏

@quantizor

Copy link
Copy Markdown
Contributor

Thanks @EnesKartal, appreciate the thorough follow-up with the extra properties and spec references. Merging this for v7 and backporting to 6.x.

@quantizor
quantizor merged commit 7bf8c98 into styled-components:main Nov 24, 2026
8 checks passed
quantizor added a commit that referenced this pull request Nov 24, 2026
…old as unitless (#5872) (#5890)

* fix: treat fontSizeAdjust, initialLetter, mathDepth, shapeImageThreshold as unitless (#5872)

* fix: use sorted Set in addUnitIfNeeded so Object.prototype keys take units
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.

Object styles append px to fontSizeAdjust, initialLetter, mathDepth, and shapeImageThreshold

2 participants