Skip to content

Conversation

@rithik56
Copy link

@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 🔺+3B(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 2785601

@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
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