Skip to content

[autocomplete] Don't submit forms when committing freeSolo value with Enter key#48679

Open
mj12albert wants to merge 3 commits into
mui:masterfrom
mj12albert:fix-autocomplete-single-enter-form-submit
Open

[autocomplete] Don't submit forms when committing freeSolo value with Enter key#48679
mj12albert wants to merge 3 commits into
mui:masterfrom
mj12albert:fix-autocomplete-single-enter-form-submit

Conversation

@mj12albert

@mj12albert mj12albert commented Jun 16, 2026

Copy link
Copy Markdown
Member

Fixes #48674

When there is a freeSolo value and the popup is open, Enter should commit the value and close the popup without triggering form submit. A second Enter is required to submit a form.

Demo: https://stackblitz.com/edit/guz4nhmz?file=src%2FDemo.tsx

  1. Type New, New York is auto-highlighted
  2. Press Enter
  3. Popup closes and commits New as the value, form doesn't submit
  4. Form submits after pressing Enter a second time

@mj12albert mj12albert added the scope: autocomplete Changes related to the autocomplete. This includes ComboBox. label Jun 16, 2026
@code-infra-dashboard

code-infra-dashboard Bot commented Jun 16, 2026

Copy link
Copy Markdown

Deploy preview

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

Bundle size

Bundle Parsed size Gzip size
@mui/material 🔺+60B(+0.01%) 🔺+26B(+0.02%)
@mui/lab 0B(0.00%) 0B(0.00%)
@mui/private-theming 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


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

@mj12albert mj12albert marked this pull request as ready for review June 17, 2026 14:52
@mj12albert mj12albert added the type: regression A bug, but worse, it used to behave as expected. label Jun 17, 2026

@siriwatknp siriwatknp left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Are you intended to add those experiments to the codebase?
In my opinion, it should not.

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: regression A bug, but worse, it used to behave as expected.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Autocomplete - incorrect behavior with autoHighlight and freeSolo enabled

3 participants