Skip to content

fix(core): align Tokenizer/PowerSearch end content with field padding#3178

Merged
cixzhang merged 1 commit into
facebook:mainfrom
durvesh1992:fix/tokenizer-endsection-padding
Jun 28, 2026
Merged

fix(core): align Tokenizer/PowerSearch end content with field padding#3178
cixzhang merged 1 commit into
facebook:mainfrom
durvesh1992:fix/tokenizer-endsection-padding

Conversation

@durvesh1992

Copy link
Copy Markdown
Contributor

Summary

Closes #2849.

In PowerSearch, the resultCount (and the Tokenizer clear button / any endContent) sat ~3px from the field's right edge instead of matching the field padding.

Root cause: the Tokenizer endSection used insetInlineEnd: calc(spacing-1 - 1px) = 3px, while the field's content padding (inputWrapperStyles.basepaddingInline: spacing-2 = 8px) and the restored text/start-icon insets (startIconWithTokens, inputCompact) all resolve to 8px. So end content was misaligned with the text in both the token and non-token states.

Fix: set endSection.insetInlineEnd to --spacing-2 (8px) so end content lines up with the field's inline padding.

Testing

  • pnpm -F @astryxdesign/core test Tokenizer PowerSearch148/148 pass.
  • Reasoning verified against inputStyles.stylex.ts (base paddingInline: spacing-2) and the existing start-side restoration styles, which target the same 8px inset.

Changeset

Included (@astryxdesign/core patch).

Closes facebook#2849.

The Tokenizer endSection (clear button + endContent, including
PowerSearch's resultCount) was positioned at insetInlineEnd of
calc(spacing-1 - 1px) = 3px, while the field's content padding
(inputWrapperStyles.base) and the restored text/start-icon insets are
spacing-2 (8px). This left resultCount ~3px from the edge, misaligned
with the text. Use spacing-2 so end content matches the field padding.
@vercel

vercel Bot commented Jun 26, 2026

Copy link
Copy Markdown

Someone 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 added the CLA Signed This label is managed by the Meta Open Source bot. label Jun 26, 2026
@vercel

vercel Bot commented Jun 26, 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 Jun 26, 2026 10:05pm

Request Review

},
endSection: {
position: 'absolute',
insetInlineEnd: `calc(${spacingVars['--spacing-1']} - 1px)`,

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.

Hmm I think this was probably originally for button edge compensation.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

You're right — good catch. The clear button here is a ghost isIconOnly button, so it carries data-astryx-edge-comp, and the original 3px (spacing-1 - 1px) was compensating for its transparent padding so the X icon optically landed at the ~8px field inset. My blanket move to 8px aligns the text resultCount (the actual bug in #2849) but over-insets the clear-button icon by ~5px.

Proposed proper fix using the existing edge-comp system: keep endSection at insetInlineEnd: spacing-2 (8px, so text aligns) and apply edgeCompSlot.inset(calc(spacing-2 - spacing-1 + 1px)) to it. That way:

The 5px amount mirrors the existing startIconWithTokens/inputCompact restoration constant. I can push that — but since I can't launch a browser locally to eyeball it, would you mind confirming on the preview you authorized once I do? Happy to adjust the amount if it's off.

@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.

I need to rethink edge compensation generally so I think this is fine for now and probably more expected.

@cixzhang cixzhang merged commit da2c60f into facebook:main Jun 28, 2026
15 checks passed
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.

XDSPowerSearch: resultCount ignores input padding (3px from edge instead of matching padding)

2 participants