Skip to content

[autocomplete] Fix popup reopening on window focus regain with openOnFocus#47790

Merged
ZeeshanTamboli merged 12 commits intomui:masterfrom
aman44444:fix/47661-autocomplete-openOnFocus
Mar 5, 2026
Merged

[autocomplete] Fix popup reopening on window focus regain with openOnFocus#47790
ZeeshanTamboli merged 12 commits intomui:masterfrom
aman44444:fix/47661-autocomplete-openOnFocus

Conversation

@aman44444
Copy link
Copy Markdown
Contributor

@aman44444 aman44444 commented Feb 16, 2026

fixes #47661

This PR fixes an issue where Autocomplete with openOnFocus={true} would reopen the popup when the browser window regained focus using a mouse click.


Preview: https://deploy-preview-47790--material-ui.netlify.app/material-ui/react-autocomplete/#playground

@mui-bot
Copy link
Copy Markdown

mui-bot commented Feb 16, 2026

Netlify deploy preview

https://deploy-preview-47790--material-ui.netlify.app/

Bundle size report

Bundle Parsed size Gzip size
@mui/material 🔺+235B(+0.05%) 🔺+2B(0.00%)
@mui/lab 0B(0.00%) 0B(0.00%)
@mui/system 0B(0.00%) 0B(0.00%)
@mui/utils 0B(0.00%) 0B(0.00%)

Details of bundle changes

Generated by 🚫 dangerJS against eb5060d

@aman44444 aman44444 marked this pull request as draft February 16, 2026 08:34
@aman44444 aman44444 marked this pull request as ready for review February 21, 2026 15:17
@zannager zannager added the scope: autocomplete Changes related to the autocomplete. This includes ComboBox. label Feb 23, 2026
@ZeeshanTamboli ZeeshanTamboli added the type: bug It doesn't behave as expected. label Feb 24, 2026
@ZeeshanTamboli ZeeshanTamboli added v7.x needs cherry-pick The PR should be cherry-picked to master after merge. labels Feb 24, 2026
Copy link
Copy Markdown
Member

@ZeeshanTamboli ZeeshanTamboli left a comment

Choose a reason for hiding this comment

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

Thanks for the PR. It seems to work correctly: https://deploy-preview-47790--material-ui.netlify.app/material-ui/react-autocomplete/#playground. But left some questions and concerns.

Comment thread packages/mui-material/src/useAutocomplete/useAutocomplete.js Outdated
Comment thread packages/mui-material/src/useAutocomplete/useAutocomplete.js Outdated
Comment thread packages/mui-material/src/useAutocomplete/useAutocomplete.js Outdated
@ZeeshanTamboli ZeeshanTamboli changed the title [material-ui][Autocomplete] Fix popup reopening on window focus regain with openOnFocus [autocomplete] Fix popup reopening on window focus regain with openOnFocus Feb 24, 2026
Comment thread packages/mui-material/src/useAutocomplete/useAutocomplete.js
Comment thread packages/mui-material/src/useAutocomplete/useAutocomplete.js
@ZeeshanTamboli
Copy link
Copy Markdown
Member

@aman44444 This seems to work. Do you find any issues in it as you mentioned in #47790 (comment).

@aman44444
Copy link
Copy Markdown
Contributor Author

@ZeeshanTamboli It’s good, but let me check one more time.

@aman44444
Copy link
Copy Markdown
Contributor Author

@ZeeshanTamboli it’s working well.

Copy link
Copy Markdown
Member

@ZeeshanTamboli ZeeshanTamboli left a comment

Choose a reason for hiding this comment

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

Looks good! I also added a test case. Thanks for the fix.

@ZeeshanTamboli ZeeshanTamboli merged commit 8f115f3 into mui:master Mar 5, 2026
18 checks passed
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 5, 2026

Cherry-pick PRs will be created targeting branches: v7.x

github-actions Bot pushed a commit that referenced this pull request Mar 5, 2026
…Focus (#47790)

Co-authored-by: Zeeshan Tamboli <zeeshan.tamboli@gmail.com>
@aman44444 aman44444 deleted the fix/47661-autocomplete-openOnFocus branch March 5, 2026 14:52
@aman44444
Copy link
Copy Markdown
Contributor Author

@ZeeshanTamboli Thank you for the opportunity!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs cherry-pick The PR should be cherry-picked to master after merge. scope: autocomplete Changes related to the autocomplete. This includes ComboBox. type: bug It doesn't behave as expected. v7.x

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[autocomplete] openOnFocus reopens popup when window regains focus and can trigger unintended option selection

4 participants