Skip to content

fix(Combobox): anchor the multi-select popup to the chips control box#125

Merged
dgraciac merged 1 commit into
mainfrom
fix/combobox-multiple-panel-anchor
Jun 18, 2026
Merged

fix(Combobox): anchor the multi-select popup to the chips control box#125
dgraciac merged 1 commit into
mainfrom
fix/combobox-multiple-panel-anchor

Conversation

@dgraciac

Copy link
Copy Markdown
Member

What

In a Combobox multiple, the floating popup anchored to the input (which floats at the end of the chip row) instead of the control box. Once several chips pushed the input toward the right edge, the listbox opened narrow and shifted right rather than keeping the control width.

This anchors the multi-select popup to the chips control box, so it keeps a constant width = the control, left-aligned, regardless of where the input sits.

Why

Base UI resolves the Combobox popup anchor as inputGroupElement ?? inputElement:

  • Single-select wraps Base UI's InputGroup (ComboboxControl), which registers inputGroupElement → popup anchors to the full-width control. ✅
  • Multi-select uses Combobox.Chips (ComboboxChips) as the bordered box, and Chips registers no inputGroupElement → the anchor fell back to the Input floating after the chips. ❌

How

ComboboxChips now publishes its DOM node through an internal React context (ComboboxAnchorContext) that ComboboxContent reads and passes as the Positioner's public anchor prop. The chips box becomes the anchor, so width: var(--anchor-width) resolves to the control width.

Single-select is unchanged: no chips box means no anchor override, so Base UI keeps anchoring to ComboboxControl (InputGroup) as before. The consumer's forwarded ref on ComboboxChips is still honoured (merged with the internal anchor ref).

No public TypeScript API change → patch.

Verification

  • typecheck + lint + format:check + build (incl. verify:dist-types) green.
  • test177/177 (added a regression test asserting the consumer ref still resolves to the chips box).
  • In-browser (Storybook, popup open via defaultOpen): with 2 chips on one line the input floats right (x=166, width=301) yet the popup matches the control box exactly (x=16, width=460). New MultipleWidePanel story added for the Chromatic baseline.

Surfaced in Alexandria's AddUsers / AddSkills multi-select pickers.

🤖 Generated with Claude Code

Base UI resolves the Combobox popup anchor as `inputGroupElement ??
inputElement`. Single-select wraps Base UI's `InputGroup`
(`ComboboxControl`), so the popup anchored to the full-width control —
but multi-select uses `Combobox.Chips`, which registers no
`inputGroupElement`, so the anchor fell back to the `Input` floating at
the end of the chip row. The popup then opened narrow and shifted right.

`ComboboxChips` now publishes its DOM node through an internal context
that `ComboboxContent` reads and passes as the Positioner's `anchor`, so
the multi-select panel keeps a constant width = the control,
left-aligned. Single-select is unchanged. No public TypeScript API
change.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@chromatic-com

chromatic-com Bot commented Jun 18, 2026

Copy link
Copy Markdown

Warning

Testing paused

Monthly snapshot limit reached. Update your plan for additional snapshots and to resume testing.

@dgraciac dgraciac merged commit d67e70c into main Jun 18, 2026
8 of 10 checks passed
@dgraciac dgraciac deleted the fix/combobox-multiple-panel-anchor branch June 18, 2026 02:44
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.

1 participant