[Menu] Use ButtonBase in MenuItem#26591
Conversation
|
mnajdova
left a comment
There was a problem hiding this comment.
Let's add a breaking changes section in migration-v4.md
It is added to |
|
@siriwatknp We are off-topic with this discussion but it's still interesting for the future. It makes me think about #9893 that we talked about with @eps1lon at some point. It seems that what you are expecting is the menu button to keep the focus when the popup opens.
From what I understand, Google Docs implements the menu (AKA menu bar) pattern: https://www.w3.org/TR/wai-aria-practices/#menu. The
Because when you click to open, the first menu item is focused, if press Enter, it activates this first option. You will find the same behavior here: https://stripe.com/docs/. |
| /** | ||
| * The system prop that allows defining system overrides as well as additional CSS styles. | ||
| */ | ||
| sx?: SxProps<Theme>; |
There was a problem hiding this comment.
| /** | |
| * The system prop that allows defining system overrides as well as additional CSS styles. | |
| */ | |
| sx?: SxProps<Theme>; |
Same as previous?
There was a problem hiding this comment.
If removed, it is all gone from docs api and proptype. Let's keep it for now.
There was a problem hiding this comment.
I think on the docs there is info that it extends some interface, so that should be enough.
There was a problem hiding this comment.
But Button, IconButton and ListItemButton also has sx in there d.ts file, should we keep the same for MenuItem? not really sure.
There was a problem hiding this comment.
Let’s keep it, but leave this conversation open, so that we can address it later.
Co-authored-by: Marija Najdova <[email protected]>
oliviertassinari
left a comment
There was a problem hiding this comment.
I can't notice anything else 👍
Co-authored-by: Olivier Tassinari <[email protected]>
|
|
||
| ```diff | ||
| -<li className="MuiButtonBase-root MuiMenuItem-root MuiListItem-root"> | ||
| +<li className="MuiButtonBase-root MuiMenuItem-root"> |
mnajdova
left a comment
There was a problem hiding this comment.
One last comment for polishing the breaking changes description, apart from that looks good 👍
eps1lon
left a comment
There was a problem hiding this comment.
Great summary description 👍
Just have some typos
Co-authored-by: Sebastian Silbermann <[email protected]>


BREAKING CHANGES
Change the default value of
anchorOrigin.verticalto follow the Material Design guidelines. The menu now displays below the anchor instead of on top of it.This conversation was marked as resolved by siriwatknp
Show conversation
You can restore the previous behavior with:
The
MenuItemcomponent inherits theButtonBasecomponent instead ofListItem.The class names related to "MuiListItem-*" are removed and theming
ListItemis no longer affectingMenuItem.prop
listItemClassesis removed, useclassesinstead.Preview: https://deploy-preview-26591--material-ui.netlify.app/components/menus/
Changes
replace
ListItemwithButtonBaseinMenuItemadd 3 more demos (IconMenu, DenseMenu and AccountMenu)
overrides nested component when compose together to have good looking by default
ListItemIconListItemTextDividerheight of MenuItem
denseThe reason I add css to override multiple component because I think this is
MenuItem's responsibility to provide good looking by default (follow Material Design). If developers needs highly customisation, they can skipMenuItemand build fromListItemButtoninstead.same markup
v4
https://codesandbox.io/s/material-demo-forked-o84t1?file=/demo.tsx
v5