Skip to content

[select][combobox] Share item indicator implementation - #5728

Merged
flaviendelangle merged 1 commit into
mui:masterfrom
flaviendelangle:simplify-item-indicator
Sep 18, 2026
Merged

flaviendelangle merged 1 commit into
mui:masterfrom
flaviendelangle:simplify-item-indicator

Conversation

@flaviendelangle

Copy link
Copy Markdown
Member

Select and Combobox duplicate their item indicator rendering and transition logic. Move that implementation into a shared memoized component, with each public wrapper passing its context's selected value and retaining the existing lazy-mount boundary. Public props and state types remain unchanged.

Add tests for mounting, unmounting, reselection, and preserving the same DOM element with keepMounted. The tests also verify that selection updates reach the memoized implementation and the internal selected prop does not reach the DOM.

Bundle sizes were measured locally before opening this PR, using freshly built packages on master at 5246e9ff5 and on this change, with the repository's bundle-size checker. All values below are bytes.

Bundle Minified delta Gzip before Gzip after Gzip delta
Select +10 40,917 40,914 -3
Combobox +10 46,805 46,800 -5
Select + Combobox -350 54,743 54,630 -113
Autocomplete 0 45,269 45,269 0
Full library -351 148,813 148,701 -112

The combined measurement uses the same checker's builder with both component namespaces imported and retained via console.log(Select, Combobox), with React and React DOM external. The other measurements use the standard entrypoints.

Validation:

  • pnpm test:jsdom ItemIndicator --no-watch: 68 passed, 6 skipped.

  • pnpm test:chromium ItemIndicator --no-watch: 74 passed.

  • pnpm build, pnpm typescript, pnpm eslint, pnpm stylelint, and pnpm prettier --branch upstream/master passed.

  • Bundle command after each build: pnpm -F ./test/bundle-size exec bundle-size-checker --filter '**/select' '**/combobox' '**/autocomplete' '@base-ui/rea[c]t' --output /tmp/indicator-size.json --concurrency 4.

  • I have followed the PR section of the contributing guide.

@pkg-pr-new

pkg-pr-new Bot commented Sep 16, 2026

Copy link
Copy Markdown
  • base-ui-tanstack-start

  • vite-css-base-ui-example

    pnpm add https://pkg.pr.new/mui/base-ui/@base-ui/react@5728
    
    pnpm add https://pkg.pr.new/mui/base-ui/@base-ui/utils@5728
    

commit: 99dd86c

@flaviendelangle flaviendelangle self-assigned this Sep 16, 2026
@flaviendelangle flaviendelangle added component: select Changes related to the select 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. component: combobox Changes related to the combobox component. labels Sep 16, 2026
@code-infra-dashboard

code-infra-dashboard Bot commented Sep 16, 2026 •

Copy link
Copy Markdown

Bundle size

Bundle Parsed size Gzip size
@base-ui/react ▼-351B(-0.08%) ▼-112B(-0.08%)

Details of bundle changes

Performance

Total duration: 1,059.43 ms -2.97 ms(-0.3%) | Renders: 76 (+0) | Paint: 1,715.56 ms -31.57 ms(-1.8%)

No significant changes — details


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

@netlify

netlify Bot commented Sep 16, 2026

Copy link
Copy Markdown

✅ Deploy Preview for base-ui ready!

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

@flaviendelangle
flaviendelangle merged commit 95ac5b9 into mui:master Sep 18, 2026
25 of 26 checks passed
@flaviendelangle
flaviendelangle deleted the simplify-item-indicator branch September 18, 2026 05:32
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. component: select Changes related to the select 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants