-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Menu] Use ButtonBase in MenuItem #26591
Conversation
Co-authored-by: Olivier Tassinari <olivier.tassinari@gmail.com>
…at/list-item-improvement
…at/list-item-improvement
…at/list-item-improvement
updated. https://deploy-preview-26591--material-ui.netlify.app/components/menus/#positioned-menu |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/** | |
* 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If removed, it is all gone from docs api and proptype. Let's keep it for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let’s keep it, but leave this conversation open, so that we can address it later.
Co-authored-by: Marija Najdova <mnajdova@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't notice anything else 👍
Co-authored-by: Olivier Tassinari <olivier.tassinari@gmail.com>
|
||
```diff | ||
-<li className="MuiButtonBase-root MuiMenuItem-root MuiListItem-root"> | ||
+<li className="MuiButtonBase-root MuiMenuItem-root"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One last comment for polishing the breaking changes description, apart from that looks good 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great summary description 👍
Just have some typos
Co-authored-by: Sebastian Silbermann <silbermann.sebastian@gmail.com>
BREAKING CHANGES
Change the default value of
anchorOrigin.vertical
to 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
MenuItem
component inherits theButtonBase
component instead ofListItem
.The class names related to "MuiListItem-*" are removed and theming
ListItem
is no longer affectingMenuItem
.prop
listItemClasses
is removed, useclasses
instead.Preview: https://deploy-preview-26591--material-ui.netlify.app/components/menus/
Changes
replace
ListItem
withButtonBase
inMenuItem
add 3 more demos (IconMenu, DenseMenu and AccountMenu)
overrides nested component when compose together to have good looking by default
ListItemIcon
ListItemText
Divider
height of MenuItem
dense
The 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 skipMenuItem
and build fromListItemButton
instead.same markup
v4
https://codesandbox.io/s/material-demo-forked-o84t1?file=/demo.tsx
v5