Skip to content

fix: Adjust spacings in token mode autosuggest - #5207

Draft
jperals wants to merge 5 commits into
mainfrom
dev-v3-jotresse-autosuggest-consistent-spacing
Draft

jperals wants to merge 5 commits into
mainfrom
dev-v3-jotresse-autosuggest-consistent-spacing

Conversation

@jperals

@jperals jperals commented Oct 29, 2026

Copy link
Copy Markdown
Member

Description

Related links, issue #, if available: n/a

How has this been tested?

Review checklist

The following items are to be evaluated by the author(s) and the reviewer(s).

Correctness

  • Changes include appropriate documentation updates.
  • Changes are backward-compatible if not indicated, see CONTRIBUTING.md.
  • Changes do not include unsupported browser features, see CONTRIBUTING.md.
  • Changes were manually tested for accessibility, see accessibility guidelines.

Security

Testing

  • Changes are covered with new/existing unit tests?
  • Changes are covered with new/existing integration tests?

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@codecov

codecov Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.76%. Comparing base (cc35fe2) to head (66b44e9).
⚠️ Report is 9 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #5207   +/-   ##
=======================================
  Coverage   97.75%   97.76%           
=======================================
  Files        1003     1003           
  Lines       32534    32552   +18     
  Branches    12082    12094   +12     
=======================================
+ Hits        31805    31823   +18     
  Misses        684      684           
  Partials       45       45           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copilot AI 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.

🟡 Changes recommended

The observer discards zero-width measurements, causing tokens to collapse while the field is hidden and preventing recalculation when it is restored at the same width.

1 open issue
What changed in this PR

This PR adjusts token-mode autosuggest spacing by rendering tokens inside the shared input field instead of a separate field wrapper.

Changes:

  • Reuses shared input styling and adds an internal inline-content slot.
  • Calculates token overflow from the combined token and input widths.
  • Updates spacing, popover clipping, and overflow test fixtures.
File Description
src/​internal/​components/​autosuggest-input/​use-token-overflow.ts Uses token and input measurements to calculate overflow.
src/​internal/​components/​autosuggest-input/​styles.scss Removes separate field styles and adjusts token layout.
src/​internal/​components/​autosuggest-input/​inline-tokens.tsx Exposes the token root for measurement.
src/​internal/​components/​autosuggest-input/​index.tsx Renders tokens through the shared input component.
src/​internal/​components/​autosuggest-input/​__tests__/​use-token-overflow.test.tsx Updates geometry mocks and overflow checks.
src/​input/​styles.scss Adds inline-content spacing and allows popovers outside the field.
src/​input/​internal.tsx Adds an internal inline-content slot and removes borderless mode.
src/​autosuggest/​__tests__/​autosuggest-token-mode.test.tsx Updates the overflow hook mock.

Review effort: Balanced

useResizeObserver(
() => (isTokenMode ? fieldRef.current : inputContainerRef.current),
() => inputContainerRef.current,
entry => entry.borderBoxWidth > 0 && setTriggerWidth(entry.borderBoxWidth)

This branch was successfully deployed

3 active deployments
dev-pages-react16 — 66b44e9a Deployed Oct 30, 2026 by jperals via deploy (React 16) / deploy #3074
dev-pages-react18 — 66b44e9a Deployed Oct 30, 2026 by jperals via deploy (React 18) / deploy #3074
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants