Skip to content

fix(field): vertically center required/optional indicator in FieldLabel#3364

Merged
rubyycheung merged 1 commit into
facebook:mainfrom
athz:fix/fieldlabel-required-vertical-align
Jul 2, 2026
Merged

fix(field): vertically center required/optional indicator in FieldLabel#3364
rubyycheung merged 1 commit into
facebook:mainfrom
athz:fix/fieldlabel-required-vertical-align

Conversation

@athz

@athz athz commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Summary

The optional/required indicator (∙ Required / ∙ Optional) in FieldLabel rendered visually high relative to the label text — most visible on Typeahead's required variant.

Root cause: the label and optionalRequired styles never set an explicit lineHeight, so both fell back to line-height: normal (~1.2). That produced mismatched line boxes (~16.8px for the 14px label vs ~14.4px for the 12px indicator). With alignItems: center, the smaller indicator centered within its shorter box and ended up off-center.

Fix: apply the intended leading tokens (--text-label-leading and --text-supporting-leading, both resolve to 20px) so the two flex children get equal-height line boxes and center correctly.

Since FieldLabel is shared, this fixes the indicator alignment across Field, Typeahead, CheckboxInput, and Switch.

Testing

  • vitest run packages/core/src/Field — 40/40 pass
  • pnpm -F @astryxdesign/core typecheck — clean
  • eslint on the changed file — clean
  • check:sync / check:changesets — clean (changeset included)
  • Visually confirmed centered.

Before
Screenshot 2026-07-02 at 10 41 19 AM

After
Screenshot 2026-07-02 at 10 47 24 AM

@vercel

vercel Bot commented Jul 2, 2026

Copy link
Copy Markdown

@athzD 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 commented Jul 2, 2026

Copy link
Copy Markdown

Hi @athz!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

@meta-cla

meta-cla Bot commented Jul 2, 2026

Copy link
Copy Markdown

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Jul 2, 2026
@vercel

vercel Bot commented Jul 2, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
astryx Ready Ready Preview, Comment Jul 2, 2026 4:11am

Request Review

@cixzhang cixzhang left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nice thank you for the fix!

@rubyycheung rubyycheung merged commit 5f1f22e into facebook:main Jul 2, 2026
15 checks passed
@athz athz deleted the fix/fieldlabel-required-vertical-align branch July 2, 2026 05:10
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 Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants