Skip to content

[select] Don't choose an option with Space during type-ahead or with modifier keys - #49923

Closed
itisrmk wants to merge 1 commit into
mui:masterfrom
itisrmk:devin/select-space-typeahead
Closed

itisrmk wants to merge 1 commit into
mui:masterfrom
itisrmk:devin/select-space-typeahead

Conversation

@itisrmk

@itisrmk itisrmk commented Nov 26, 2026

Copy link
Copy Markdown

Fixes #49919

Since #48615, SelectInput's handleItemKeyDown clicks the focused option on every Space keydown. This breaks the open menu's type-ahead in three ways:

  1. A Space typed during a type-ahead search (day s to reach "Day shift") chooses the option the search had reached and closes the menu.
  2. A Space that toggles an option in a multiple Select is also added to MenuList's type-ahead buffer, so a letter typed right after it searches for " u" and matches nothing.
  3. Ctrl/Alt/Meta+Space chooses the option.

Changes:

  • MenuList: Space only continues an active type-ahead search, it no longer starts one. This is the same rule the closed Select type-ahead already follows ("uses Space in an active buffer" / "opens the popup on initial Space").
  • SelectInput: handleItemKeyDown ignores modified keys (MenuList already leaves these to the caller) and doesn't choose an option when the Space falls within MenuList's type-ahead window (500 ms after the last type-ahead key). The Space still calls preventDefault() so the page doesn't scroll.

The new open typeahead tests in Select.test.js fail on master and pass with this change.

This PR was written with AI assistance (Devin).

…modifier keys

Co-Authored-By: Rahul Kashayp <rahulmkashyap@gmail.com>
@code-infra-dashboard

code-infra-dashboard Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

Deploy preview

https://deploy-preview-49923--material-ui.netlify.app/
QR code for https://deploy-preview-49923--material-ui.netlify.app/

Bundle size

Bundle Parsed size Gzip size
@mui/material 🔺+235B(+0.04%) 🔺+87B(+0.05%)
@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

Performance

No regressions in 32 benchmarks · precise to ±7.4% (±13.8% at worst) · ran 4m 46s · details


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

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[select] Space on an option ignores the open-menu type-ahead and modifier keys, and starts a type-ahead search after toggling (since 9.1)

1 participant