Skip to content

[combobox] Add keepFilterText prop for repeated selections - #4360

Closed
atomiks wants to merge 1 commit into
mui:masterfrom
atomiks:codex/combobox-item-click-behavior
Closed

atomiks wants to merge 1 commit into
mui:masterfrom
atomiks:codex/combobox-item-click-behavior

Conversation

@atomiks

@atomiks atomiks commented Mar 17, 2026 •

Copy link
Copy Markdown
Contributor

Closes #3977
Closes #4348

This adds keepFilterText to Combobox.Root for multiple-selection workflows that keep using the same filter after each pick. When the user selects an item while filtering, the current query stays in the input and the list stays open so more matching items can be selected.

A use case is GitHub's Labels combobox:

GitHub Labels combobox

Changes

  • Add keepFilterText for repeated filtered selection in multiple mode.
  • Cover inputs outside the popup, inside the popup, and inline lists.
  • Regenerate the Combobox API docs.

Bundle size

A fresh same-worktree comparison against bf2e52725 measured @base-ui/react at 0 B parsed / +16 B gzip. The implementation folds the new behavior into the existing filter check without adding parsed runtime size.

@atomiks atomiks added type: new feature Expand the scope of the product to solve a new problem. component: combobox Changes related to the combobox component. labels Mar 17, 2026
@pkg-pr-new

pkg-pr-new Bot commented Mar 17, 2026 •

Copy link
Copy Markdown

commit: 0a6cc86

@mui-bot

mui-bot commented Mar 17, 2026 •

Copy link
Copy Markdown

Bundle size report

Bundle Parsed size Gzip size
@base-ui/react 🔺+674B(+0.15%) 🔺+216B(+0.15%)

Details of bundle changes


Check out the code infra dashboard for more information about this PR.

@netlify

netlify Bot commented Mar 17, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for base-ui ready!

Name Link
🔨 Latest commit 0a6cc86
🔍 Latest deploy log https://app.netlify.com/projects/base-ui/deploys/6a61821ffafd0f0008227e97
😎 Deploy Preview https://deploy-preview-4360--base-ui.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions github-actions Bot added PR: out-of-date The pull request has merge conflicts and can't be merged. and removed PR: out-of-date The pull request has merge conflicts and can't be merged. labels Mar 23, 2026
@atomiks atomiks changed the title [combobox] Add item click behavior controls [combobox] Add keepFilterText Mar 25, 2026
@atomiks atomiks changed the title [combobox] Add keepFilterText [combobox] Add keepFilterText for repeated selections Mar 25, 2026
@atomiks atomiks changed the title [combobox] Add keepFilterText for repeated selections [combobox] Add keepFilterText prop for repeated selections Mar 25, 2026
@atomiks
atomiks marked this pull request as ready for review March 25, 2026 11:53
@colmtuite colmtuite added breaking change Introduces changes that are not backward compatible. and removed breaking change Introduces changes that are not backward compatible. labels Apr 7, 2026
@mnajdova mnajdova removed the breaking change Introduces changes that are not backward compatible. label Apr 7, 2026
@github-actions github-actions Bot added the PR: out-of-date The pull request has merge conflicts and can't be merged. label May 1, 2026

@michaldudak michaldudak left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

PR review

No blocking findings. I found one close-animation regression in the multiple + input-inside-popup path, and the focused pnpm test:jsdom ComboboxRoot --no-watch suite passes.

Bugs (1)

1. 🟡 Preserve the filtered popup while closing

Location: packages/react/src/combobox/root/AriaCombobox.tsx:585

if (pendingInputBehaviorRef.current.closeAction !== 'skip') {
  setInputValue('', createChangeEventDetails(REASONS.inputClear, eventDetails.event));
}

For multiple comboboxes with the input inside the popup, this now clears the query immediately on close. The previous code explicitly deferred that clear until unmount for this placement, so the filtered list would not flash back to the unfiltered list during an exit animation.

Failure scenario: In a multiple combobox with Combobox.Input inside Combobox.Popup, type ap, press Escape or click outside, and the closing popup can visibly reset from filtered results to all items before the exit transition finishes.

Fix: Restore the inside-popup guard here, for example only clear immediately when !inputInsidePopup || inline, and let handleUnmount clear the popup input for the animated inside-popup case.

Tests (1)

1. 🟡 Restore default inside-popup multiple selection coverage

Location: packages/react/src/combobox/root/ComboboxRoot.test.tsx:2544

describe('prop: keepFilterText', () => {

The old default behavior test for multiple mode with the input inside the popup was replaced by keepFilterText coverage. That leaves the default path unpinned: selecting while filtering inside the popup should keep the popup open but clear the input.

Failure scenario: A future change could make the default inside-popup multiple workflow preserve text, close, or fail to clear, and this suite would still pass.

Fix: Add back a test without keepFilterText for input-inside-popup multiple mode, asserting the popup remains open and the input clears after selecting a filtered item.

Simplifications (0)

No findings.

Docs (0)

No findings.

Verdict

Approve after nits — the issues are non-blocking but worth fixing before merge.

@atomiks
atomiks force-pushed the codex/combobox-item-click-behavior branch from 2fcaa4e to 0a6cc86 Compare July 23, 2026 02:53
@github-actions github-actions Bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged. label Jul 23, 2026
@code-infra-dashboard

code-infra-dashboard Bot commented Jul 23, 2026 •

Copy link
Copy Markdown

Bundle size

Bundle Parsed size Gzip size
@base-ui/react 0B(0.00%) 🔺+16B(+0.01%)

Details of bundle changes

Performance

Total duration: 1,116.59 ms -23.72 ms(-2.1%) | Renders: 78 (+0) | Paint: 1,775.92 ms -27.51 ms(-1.5%)

No significant changes — details


Check out the code infra dashboard for more information about this PR.

@github-actions github-actions Bot added the PR: out-of-date The pull request has merge conflicts and can't be merged. label Aug 11, 2026
@atomiks

atomiks commented Aug 12, 2026

Copy link
Copy Markdown
Contributor Author

Closed by #5362

@atomiks atomiks closed this Aug 12, 2026
@atomiks
atomiks deleted the codex/combobox-item-click-behavior branch August 12, 2026 10:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component: combobox Changes related to the combobox component. PR: out-of-date The pull request has merge conflicts and can't be merged. type: new feature Expand the scope of the product to solve a new problem.

Projects

None yet

5 participants