Skip to content

Conversation

@rithik56
Copy link
Contributor

@rithik56 rithik56 commented Nov 8, 2025

Fixes #47212

fix(Autocomplete): prevent error when focusing non-existent element

Add optional chaining when focusing elements in useAutocomplete to handle cases where the element doesn't exist. Add tests to verify the behaviour

@mui-bot
Copy link

mui-bot commented Nov 8, 2025

Netlify deploy preview

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

Bundle size report

Bundle Parsed size Gzip size
@mui/material 🔺+9B(0.00%) 🔺+3B(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 499839a

@ZeeshanTamboli ZeeshanTamboli added type: bug It doesn't behave as expected. scope: autocomplete Changes related to the autocomplete. This includes ComboBox. labels Nov 8, 2025
rithik56 and others added 2 commits November 8, 2025 16:42
Ensure focus is only attempted when value exists in ArrowLeft handler
Remove optional chaining as it's not needed after null check
@ZeeshanTamboli ZeeshanTamboli changed the title [autocomplete] Prevent error when focusing non-existent element [autocomplete] Fix ArrowLeft keypress throws error if value not set when single value rendering is used Nov 9, 2025
@ZeeshanTamboli ZeeshanTamboli changed the title [autocomplete] Fix ArrowLeft keypress throws error if value not set when single value rendering is used [autocomplete] Fix ArrowLeft crash when value is is not set with single-value rendering Nov 9, 2025
@rithik56 rithik56 changed the title [autocomplete] Fix ArrowLeft crash when value is is not set with single-value rendering [autocomplete] Fix ArrowLeft crash when value is not set with single-value rendering Nov 9, 2025
@ZeeshanTamboli
Copy link
Member

ZeeshanTamboli commented Nov 10, 2025

@rithik56 Can you try to push with an empty commit? I am not sure why the two required jobs e2e-website and deploy/netlify aren't running in the CI. Same is the case in #47215.

@rithik56
Copy link
Contributor Author

Yes @ZeeshanTamboli. Will do this

@rithik56
Copy link
Contributor Author

@ZeeshanTamboli I tried pushing the empty commit but the CI is not getting triggered

@rithik56 rithik56 closed this Nov 10, 2025
@rithik56 rithik56 reopened this Nov 10, 2025
@rithik56 rithik56 closed this Nov 10, 2025
@rithik56 rithik56 reopened this Nov 10, 2025
@ZeeshanTamboli
Copy link
Member

ZeeshanTamboli commented Nov 11, 2025

Hmm, I tried again but those two particular CI jobs aren't running.

Copy link
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.

@rithik56 We re-tried the netlify build+cleared the cache and the CI is passing now. I had made a few changes in the code. Looks good now. Thanks for the pull request.

@ZeeshanTamboli ZeeshanTamboli merged commit 130b7c1 into mui:master Nov 11, 2025
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope: autocomplete Changes related to the autocomplete. This includes ComboBox. type: bug It doesn't behave as expected.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[autocomplete] ArrowLeft throws error if value not set when single value rendering is used

3 participants