Skip to content

[autocomplete] Fix Autocomplete not using its internal filter method when mode is list - #3936

Merged
ZeeshanTamboli merged 3 commits into
mui:masterfrom
ZeeshanTamboli:fix-autocomplete-not-using-baseFilter
Feb 3, 2026
Merged

ZeeshanTamboli merged 3 commits into
mui:masterfrom
ZeeshanTamboli:fix-autocomplete-not-using-baseFilter

Conversation

@ZeeshanTamboli

@ZeeshanTamboli ZeeshanTamboli commented Feb 2, 2026 •

Copy link
Copy Markdown
Member

Fix Autocomplete not using its internal baseFilter.

When mode="list" (the default), Autocomplete was not using its internal baseFilter and instead relied on the Combobox's default filtering behavior. This worked previously only because both used the same logic.

This change ensures Autocomplete consistently applies its own baseFilter in list mode, rather than falling back to Combobox filtering.

This will reduce the computation time slightly.

@ZeeshanTamboli ZeeshanTamboli added 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: autocomplete Changes related to the autocomplete component. labels Feb 2, 2026
@ZeeshanTamboli ZeeshanTamboli changed the title [autocomplere] Fix Autocomplete not using its internal filter method when mode is list [autocomplete] Fix Autocomplete not using its internal filter method when mode is list Feb 2, 2026
@pkg-pr-new

pkg-pr-new Bot commented Feb 2, 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@3936
    
    pnpm add https://pkg.pr.new/mui/base-ui/@base-ui/utils@3936
    

commit: 10c912c

@netlify

netlify Bot commented Feb 2, 2026

Copy link
Copy Markdown

✅ Deploy Preview for base-ui ready!

Name Link
🔨 Latest commit 1c7d520
🔍 Latest deploy log https://app.netlify.com/projects/base-ui/deploys/6980ad8611d4f300088de0d5
😎 Deploy Preview https://deploy-preview-3936--base-ui.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

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

@mui-bot

mui-bot commented Feb 2, 2026 •

Copy link
Copy Markdown

Bundle size report

Bundle Parsed size Gzip size
@base-ui/react ▼-16B(0.00%) ▼-3B(0.00%)

Details of bundle changes


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

@netlify

netlify Bot commented Feb 2, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for base-ui ready!

Name Link
🔨 Latest commit 10c912c
🔍 Latest deploy log https://app.netlify.com/projects/base-ui/deploys/69819184b320a30008256030
😎 Deploy Preview https://deploy-preview-3936--base-ui.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

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

@ZeeshanTamboli
ZeeshanTamboli marked this pull request as ready for review February 2, 2026 14:03
@greptile-apps

greptile-apps Bot commented Feb 2, 2026

Copy link
Copy Markdown
Contributor

Greptile Overview

Greptile Summary

This PR fixes Autocomplete to consistently use its internal baseFilter method when mode="list" (the default), instead of falling back to the Combobox component's default filtering behavior.

What changed:

  • Line 97: Changed other.filter to baseFilter in the non-both mode branch
  • Line 102: Removed other.filter from the dependency array since it's no longer used in this context

Why this matters:
Previously, when mode="list", the Autocomplete would pass other.filter (which is undefined if not provided) to Combobox, causing Combobox to use its own default filter. While both filters used the same logic (collator.contains), this created an unnecessary dependency on Combobox's implementation details.

Impact:

  • Behavior remains unchanged (both filters use the same logic)
  • Slightly improved performance by avoiding redundant filter creation
  • Better encapsulation - Autocomplete now owns its filtering logic
  • Reduced coupling between Autocomplete and Combobox

Confidence Score: 5/5

  • This PR is safe to merge with no concerns
  • The change is a small, well-contained refactoring that improves code architecture without changing behavior. The logic is correct for all four modes (list, both, inline, none), and the dependency array is properly updated. Existing tests verify the filtering behavior continues to work as expected.
  • No files require special attention

Important Files Changed

Filename Overview
packages/react/src/autocomplete/root/AutocompleteRoot.tsx Fixed Autocomplete to use its internal baseFilter instead of relying on Combobox's default filter in list mode

@oliviertassinari oliviertassinari 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 Feb 2, 2026
@ZeeshanTamboli
ZeeshanTamboli merged commit cfbfe37 into mui:master Feb 3, 2026
7 checks passed
@ZeeshanTamboli
ZeeshanTamboli deleted the fix-autocomplete-not-using-baseFilter branch February 3, 2026 06:17
@atomiks atomiks mentioned this pull request Feb 17, 2026
1 task done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component: autocomplete Changes related to the autocomplete component. type: bug It doesn't behave as expected.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants