-
-
Notifications
You must be signed in to change notification settings - Fork 32.7k
Open
Labels
has workaroundThere’s a bug, but users have a complete workaround, so no urgent fix or release is needed.There’s a bug, but users have a complete workaround, so no urgent fix or release is needed.scope: menuChanges related to the menu.Changes related to the menu.waiting for 👍Waiting for upvotes. Open for community feedback and needs more interest to be worked on.Waiting for upvotes. Open for community feedback and needs more interest to be worked on.
Description
Duplicates
- I have searched the existing issues
Latest version
- I have tested the latest version
Current behavior 😯
see https://codesandbox.io/s/iconmenu-demo-material-ui-forked-i2xk9i for a code example.
Today, by an error of a CSS selector (in my opinion), a Divider will not get correct margin-bottom (and thus be very close to the first MenuItem).
This bug has two causes based on the selector (https://github.com/mui/material-ui/blob/master/packages/mui-material/src/MenuItem/MenuItem.js#L115) used:
- the style is appended to
MenuItemnotMenu - the style uses the
+CSS selector which means it will only select dividers placed immediately after menu items. in the case of a divider being first, though, this will never match.
Expected behavior 🤔
| BEFORE | AFTER |
|---|---|
![]() |
![]() |
There should be a margin bottom for the first item if it is a Divider.
Steps to reproduce 🕹
Steps:
- Create a
Menuand add aDividerbefore anyMenuItem.
Context 🔦
Consider the case of a UI that has divided menu items like this from Insomnia:

In this kind of UI, it's very common to have a divider beginning a menu item list.
Your environment 🌎
The docs. See link above.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
has workaroundThere’s a bug, but users have a complete workaround, so no urgent fix or release is needed.There’s a bug, but users have a complete workaround, so no urgent fix or release is needed.scope: menuChanges related to the menu.Changes related to the menu.waiting for 👍Waiting for upvotes. Open for community feedback and needs more interest to be worked on.Waiting for upvotes. Open for community feedback and needs more interest to be worked on.

