[style-value-parser] Build fix: mirror horizontal radii when border-radius has no "/" - #1907
Open
henryqdineen wants to merge 2 commits into
Open
henryqdineen wants to merge 2 commits into
henryqdineen wants to merge 2 commits into
Conversation
…o `/` Without a `/`, BorderRadiusShorthand defaulted the missing vertical radii from verticalTopLeft, so `10px 20px` serialized as `10px 20px / 10px`. This was masked until facebook#1742/facebook#1759 made toString read the vertical values. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed / motivation ?
mainis currently red:packages/style-value-parserfailsborder-radius.test.js › symmetric radii serialize without a /, becauseroundTrip('10px 20px')returns10px 20px / 10px. I noticed it while rebasing #1700 ontomain, which now has a failingtests / packagesbuild even though that PR only touchesbabel-plugin.Why it broke main: Without a
/, the parser passes only the four horizontal radii toBorderRadiusShorthand, and the constructor filled in the missing vertical radii fromverticalTopLeftrather than from their horizontal counterparts. So10px 20pxwas stored as horizontal10 20 10 20/ vertical10 10 10 10. That internal state has always been wrong, buttoStringhid it: it built the vertical string (sStr) from the horizontal values, so both halves always matched and the/was dropped. #1759 fixedsStrto read the vertical values (and #1742 made the same change), which exposed the bad constructor defaults. #1759's own new round-trip test fails on its own commit, but thetestsworkflow never ran on that PR, so it merged without anyone seeing it fail.Fix: When no vertical radii are passed, each vertical radius now mirrors its horizontal counterpart, per the CSS spec. When some vertical radii are passed, the existing CSS fill-in rules still apply to the rest (
topRightfalls back totopLeft,bottomRighttotopLeft,bottomLefttotopRight).Linked PR/Issues
Follow-up to #1759 and #1742. Unblocks #1700.
Additional Context
The existing
Valid: border-radius: …parse tests compareparse(...)tonew BorderRadiusShorthand(...), so both sides go through the same constructor defaults and couldn't catch this. The round-trip test from #1759 does catch it and now passes.npm run test:packages,flow check, and Prettier all pass locally.This also fixes a Prettier failure on
main: an assertion added in #1742 toborder-radius.test.jswasn't formatted.Pre-flight checklist
Contribution Guidelines
🤖 Generated with Claude Code