fix(field): vertically center required/optional indicator in FieldLabel#3364
Conversation
|
@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. |
|
Hi @athz! Thank you for your pull request and welcome to our community. Action RequiredIn 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. ProcessIn 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 If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks! |
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
cixzhang
left a comment
There was a problem hiding this comment.
Nice thank you for the fix!
Summary
The optional/required indicator (
∙ Required/∙ Optional) inFieldLabelrendered visually high relative to the label text — most visible onTypeahead's required variant.Root cause: the
labelandoptionalRequiredstyles never set an explicitlineHeight, so both fell back toline-height: normal(~1.2). That produced mismatched line boxes (~16.8px for the 14px label vs ~14.4px for the 12px indicator). WithalignItems: center, the smaller indicator centered within its shorter box and ended up off-center.Fix: apply the intended leading tokens (
--text-label-leadingand--text-supporting-leading, both resolve to 20px) so the two flex children get equal-height line boxes and center correctly.Since
FieldLabelis shared, this fixes the indicator alignment acrossField,Typeahead,CheckboxInput, andSwitch.Testing
vitest run packages/core/src/Field— 40/40 passpnpm -F @astryxdesign/core typecheck— cleaneslinton the changed file — cleancheck:sync/check:changesets— clean (changeset included)Before

After
