Skip to content

[combobox] Support keyed values with object items#4419

Closed
atomiks wants to merge 1 commit into
mui:masterfrom
atomiks:codex/combobox-keyed-values
Closed

[combobox] Support keyed values with object items#4419
atomiks wants to merge 1 commit into
mui:masterfrom
atomiks:codex/combobox-keyed-values

Conversation

@atomiks

@atomiks atomiks commented Mar 23, 2026

Copy link
Copy Markdown
Contributor

Fixes #3865

Stricter alternative to #4097 without a new prop


This makes the implicit keyed combobox path predictable when items use the { value, label } shape and the selected value is the primitive item.value.

It keeps the supported keyed path consistent across display, selection, comparison, and docs, while tightening TypeScript so unsupported object-item shapes fail earlier instead of drifting at runtime.

Changes

  • Add support for keyed primitive values with { value, label } combobox items without introducing a new prop.
  • Keep label resolution, selected-index sync, keyboard selection, and equality handling aligned in the supported keyed path.
  • Tighten the type surface so unsupported implicit shapes are rejected, and document the item-shaped vs keyed value modes more clearly.
  • Add regression coverage for keyed values, custom equality, empty keyed state behavior, and typed wrapper patterns.

@atomiks atomiks added type: bug It doesn't behave as expected. component: combobox Changes related to the combobox component. labels Mar 23, 2026
@pkg-pr-new

pkg-pr-new Bot commented Mar 24, 2026

Copy link
Copy Markdown

commit: 0d2f63c

@mui-bot

mui-bot commented Mar 24, 2026

Copy link
Copy Markdown

Bundle size report

Bundle Parsed size Gzip size
@base-ui/react 🔺+1.11KB(+0.24%) 🔺+391B(+0.27%)

Details of bundle changes


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

@netlify

netlify Bot commented Mar 24, 2026

Copy link
Copy Markdown

Deploy Preview for base-ui ready!

Name Link
🔨 Latest commit 0d2f63c
🔍 Latest deploy log https://app.netlify.com/projects/base-ui/deploys/69f2ea887283b3000848f79c
😎 Deploy Preview https://deploy-preview-4419--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 the PR: out-of-date The pull request has merge conflicts and can't be merged. label Mar 30, 2026
@atomiks
atomiks force-pushed the codex/combobox-keyed-values branch from 192437e to 0d2f63c Compare April 30, 2026 05:37
@github-actions github-actions Bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged. label Apr 30, 2026
@atomiks
atomiks marked this pull request as ready for review April 30, 2026 05:37
@code-infra-dashboard

code-infra-dashboard Bot commented Apr 30, 2026

Copy link
Copy Markdown

Bundle size

Bundle Parsed size Gzip size
@base-ui/react 🔺+1.08KB(+0.24%) 🔺+371B(+0.25%)

Details of bundle changes

Performance

Total duration: 1,501.59 ms +19.38 ms(+1.3%) | Renders: 53 (+0) | Paint: 2,292.40 ms +26.13 ms(+1.2%)

Test Duration Renders
Checkbox mount (500 instances) 102.82 ms 🔺+22.40 ms(+27.8%) 1 (+0)
Slider mount (300 instances) 187.91 ms 🔺+19.59 ms(+11.6%) 3 (+0)
Mixed surface mount (app-like density) 112.80 ms 🔺+8.41 ms(+8.1%) 5 (+0)
Scroll Area mount (300 instances) 109.08 ms 🔺+7.15 ms(+7.0%) 3 (+0)
Select open (500 options) 62.35 ms 🔺+4.19 ms(+7.2%) 14 (+0)

…and 7 more — details


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

@atomiks

atomiks commented Jun 10, 2026

Copy link
Copy Markdown
Contributor Author

Replacing with #4985

@atomiks atomiks closed this Jun 10, 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] value gets cleared if shape of value differs from items

2 participants