Repository navigation
Description
Steps to reproduce
Minimal reproduction:
import * as React from 'react';
import Select from '@mui/material/Select';
import MenuItem from '@mui/material/MenuItem';
export default function Demo() {
const [single, setSingle] = React.useState('');
const [multiple, setMultiple] = React.useState([]);
return (
<>
<Select value={single} onChange={(e) => setSingle(e.target.value)} displayEmpty sx={{ m: 1, minWidth: 200 }}>
<MenuItem value="Night shift">Night shift</MenuItem>
<MenuItem value="Day off">Day off</MenuItem>
<MenuItem value="Day shift">Day shift</MenuItem>
</Select>
<Select multiple value={multiple} onChange={(e) => setMultiple(e.target.value)} displayEmpty sx={{ m: 1, minWidth: 200 }}>
<MenuItem value="Admin">Admin</MenuItem>
<MenuItem value="User">User</MenuItem>
</Select>
</>
);
}- Single select: focus it, press ArrowDown to open, then quickly type
d,a,y, Space,s(to reach "Day shift"). - Multiple select: open it with ArrowDown (focus on "Admin"), press Space, then within half a second press
u. - Either select, open: press Ctrl+Space (or Alt+Space) on the focused option.
Current behavior
- The Space typed inside the type-ahead search chooses the option the search had reached ("Day off") and closes the list; the search never gets to "Day shift".
- Space toggles "Admin", but
udoes not move focus to "User": the Space was also added toMenuList's type-ahead buffer, so the search is " u" and matches nothing until the 500 ms window expires. - A modified Space chooses or toggles the option.
Expected behavior
- A Space typed within the type-ahead window continues the search and chooses nothing, as with the menu's printable keys (WAI-ARIA APG listbox: type-ahead accepts multiple characters typed in rapid succession).
- A Space that toggles an option does not start a type-ahead search.
- Space with Ctrl, Cmd or Alt does not choose (MenuList already leaves modified keys to the caller).
Context
Introduced in 9.1.0 by "[select] Allow spacebar to select elements (#48615)". SelectInput clones every option with onKeyDown: handleItemKeyDown(child), which calls event.currentTarget.click() on any Space keydown whose target is the option and that is not repeat or defaultPrevented. It does not look at the type-ahead state, at modifier keys, or stop the event, and MenuList's handleKeyDown (which does not check defaultPrevented) then appends the Space to its search. Because the clone sets an explicit onKeyDown, an app cannot adjust this from theme.components.MuiMenuItem.defaultProps.onKeyDown (an explicit prop wins over a theme default, and only child.props.onKeyDown is chained); the workaround we use is a theme default onKeyDownCapture that cancels a Space inside the window or with a modifier, and stops a choosing Space after clicking.
A possible fix: in handleItemKeyDown, skip Ctrl/Meta/Alt, skip a Space that falls inside MenuList's type-ahead window (the menu already tracks lastTime), and stop propagation after the click so the Space does not reach MenuList's search.
Your environment
@mui/material 9.1.0 through 9.6.0 (9.0.1 does not choose on Space at all); React 19; Chrome (current stable), macOS. Also reproduced in jsdom with @testing-library/user-event.
Search keywords:
Activity
github-actions commentedon Nov 30, 2026
This issue has been closed. If you have a similar problem but not exactly the same, please open a new issue.
Now, if you have additional information related to this issue or things that could help future readers, feel free to leave a comment.
@paulohsz Thanks again for creating this issue! If you have a moment, we would love to hear your thoughts on how we handled it with this short feedback form.