Skip to content

[combobox] Return highlight to selected item on query clear#5232

Draft
atomiks wants to merge 18 commits into
mui:masterfrom
atomiks:claude/confident-cori-67db47
Draft

[combobox] Return highlight to selected item on query clear#5232
atomiks wants to merge 18 commits into
mui:masterfrom
atomiks:claude/confident-cori-67db47

Conversation

@atomiks

@atomiks atomiks commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Closes #5227

Supersedes #5148.

Clearing a query replaces the filtered item tree while the selected item must be highlighted and scrolled back into view. The old registry committed refs, values, labels, and indexes separately, so a Combobox-only retry could still navigate using partially updated data.

Composite now publishes one settled, index-addressed item snapshot. This also covers #5148: explicitly indexed non-virtualized items remain registered for pointer navigation, lifecycle resets repopulate the element registry, and explicit and automatic indexes can safely coexist by reserving explicit slots. These belong together because both features require the same atomic registry invariant.

Changes

  • Restore the selected item after manual, closing, and selection-triggered query clears.
  • Support controlled indexes, DOM reorders, virtualization, and closed-trigger typeahead through the same committed registry.

Measurements

Measurement Result vs. master
Open 500 items -10.8% React / -8.9% paint
Filter, 500 remain -7.5%
Filter, ~11 remain +0.17% filter work; 17 → 15 renders

@atomiks atomiks added component: combobox Changes related to the combobox component. type: enhancement It’s an improvement, but we can’t make up our mind whether it's a bug fix or a new feature. labels Jul 14, 2026
@pkg-pr-new

pkg-pr-new Bot commented Jul 14, 2026

Copy link
Copy Markdown

commit: f1a8060

@code-infra-dashboard

code-infra-dashboard Bot commented Jul 14, 2026

Copy link
Copy Markdown

Bundle size

Bundle Parsed size Gzip size
@base-ui/react 🔺+2.06KB(+0.46%) 🔺+774B(+0.53%)

Details of bundle changes

Performance

Total duration: 1,187.46 ms -183.18 ms(-13.4%) | Renders: 76 (▼-2) | Paint: 1,875.98 ms -247.25 ms(-11.6%)

Test Duration Renders
Slider mount (300 instances) 113.09 ms ▼-52.36 ms(-31.6%) 2 (▼-1)
Tabs mount (200 instances) 180.82 ms ▼-48.26 ms(-21.1%) 3 (▼-1)
Scroll Area mount (300 instances) 77.14 ms ▼-28.10 ms(-26.7%) 3 (+0)

11 tests within noise — details


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

@netlify

netlify Bot commented Jul 14, 2026

Copy link
Copy Markdown

Deploy Preview for base-ui ready!

Name Link
🔨 Latest commit f1a8060
🔍 Latest deploy log https://app.netlify.com/projects/base-ui/deploys/6a58b79415e5b500084dd1f0
😎 Deploy Preview https://deploy-preview-5232--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.

@atomiks atomiks force-pushed the claude/confident-cori-67db47 branch 3 times, most recently from 083f7b2 to 8b9b57e Compare July 15, 2026 05:29
@github-actions github-actions Bot added the PR: out-of-date The pull request has merge conflicts and can't be merged. label Jul 15, 2026
@atomiks atomiks force-pushed the claude/confident-cori-67db47 branch from f66720b to e644b7f Compare July 15, 2026 10:39
@github-actions github-actions Bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged. label Jul 15, 2026
@atomiks atomiks force-pushed the claude/confident-cori-67db47 branch 2 times, most recently from 2c570eb to ff3f9f6 Compare July 15, 2026 11:27
@atomiks atomiks force-pushed the claude/confident-cori-67db47 branch from ff3f9f6 to 9d1cef7 Compare July 15, 2026 11:59
@atomiks atomiks added type: bug It doesn't behave as expected. and removed type: enhancement It’s an improvement, but we can’t make up our mind whether it's a bug fix or a new feature. labels Jul 15, 2026
@github-actions github-actions Bot added the PR: out-of-date The pull request has merge conflicts and can't be merged. label Jul 16, 2026
@github-actions github-actions Bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged. label Jul 16, 2026
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. type: bug It doesn't behave as expected.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[combobox] Return highlight to the selected item

1 participant