I discovered this with MenuItem but tested that it also occurs with ButtonBase directly.
<MenuItem onClick={[onClickItem, 5]}>Item 5</MenuItem>
Actual behavior
When you use the array syntax for onClick, it works when clicking with the mouse but not when pressing enter/space on the keyboard.
Expected behavior
The array syntax should work the same for keyboard and mouse - either working for both, or not working at all. Ideally reflected in the typescript type definition for the onClick prop.
I discovered this with
MenuItembut tested that it also occurs withButtonBasedirectly.Actual behavior
When you use the array syntax for
onClick, it works when clicking with the mouse but not when pressing enter/space on the keyboard.Expected behavior
The array syntax should work the same for keyboard and mouse - either working for both, or not working at all. Ideally reflected in the typescript type definition for the
onClickprop.