Skip to content

fix(button): keep calc and var padding instead of writing 0 - #3930

Open
hsusul wants to merge 4 commits into
resend:canaryfrom
hsusul:fix/button-unparsed-padding
Open

hsusul wants to merge 4 commits into
resend:canaryfrom
hsusul:fix/button-unparsed-padding

Conversation

@hsusul

@hsusul hsusul commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Why

Button copies numeric padding longhands onto the anchor after the author's style. An unparsed token became 0, and that longhand replaced calc() and var(). A unitless 0 failed the same parser, so the pixel sides of a shorthand never became longhands and Outlook's spacer stayed at 0.

Fixes #3929

What changed

A unitless 0 counts as a length. Each side of a shorthand converts on its own. A side that is calc() or var() stays on the original padding declaration and is not written as 0.

Scope

Button padding parsing and the longhands Button writes onto the anchor.

Tradeoffs

A length this parser cannot convert, such as 15cm on one side of a mixed shorthand, still does not become a numeric longhand. The author's padding declaration remains.

Blast Radius

12px 20px and 9pt 15pt still become pixel longhands. Pure calc() and var() no longer gain padding-*:0.

Verification

Rendered the Button with @react-email/render after esbuild, on canary beda35bb plus this branch. calc(8px + 4px) keeps its declaration and has no padding-top:0. 0 16px renders padding-right:16px;padding-left:16px with mso-font-width:400%. 12px 0 renders mso-text-raise:18px. The project pnpm test was not run. pnpm in this environment cannot start.


Summary by cubic

Fixes Button padding parsing so calc() and var() values stay as written instead of being replaced by padding-*:0 longhands, and unitless 0 now counts as a valid length. Resolves #3929.

  • Parse each side of a padding shorthand independently; sides that can't convert to a length keep the author's padding declaration.
  • Shorthands like 0 20px now generate all four longhands, so Outlook spacers still render correctly.
  • Mixed shorthands like 8px calc(4px + 4px) write longhands only for the convertible side.
  • Non-convertible units (for example 15cm) fall back to the original declaration and don't produce longhands.

Written for commit 986d43a. Summary will update on new commits.

View guided diff

@changeset-bot

changeset-bot Bot commented Nov 22, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 986d43a

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@vercel

vercel Bot commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

@hsusul is attempting to deploy a commit to the resend Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions github-actions Bot added the linear-synced PR has been synced to Linear label Nov 22, 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

linear-synced PR has been synced to Linear

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Button padding of calc(), var(), or unitless 0 is replaced by 0

1 participant