Skip to content

[Menu] Remove MenuItem dependency on ListItem #21587

Closed
@jedwards1211

Description

@jedwards1211

A 4px margin was added to the top and bottom of ListItemText in #15339, causing an inconsistency between items that use it and items that just have a string child.

  • The issue is present in the latest release.
  • I have searched the issues of this repository and believe that this is not a duplicate.

Current Behavior 😯

The MenuItems in this JSX render with different heights when the viewport width >= 600:

    <MenuList>
      <MenuItem style={{ backgroundColor: "green" }}>
        without ListItemText
      </MenuItem>
      <MenuItem style={{ backgroundColor: "red" }}>
        <ListItemText>with ListItemText</ListItemText>
      </MenuItem>
    </MenuList>

image

When the viewport is narrower than 600px, a media query deactivates and their minHeight becomes 48px (ironically causing them to get taller on narrower screens...)

Expected Behavior 🤔

The menu items are the same height, like they used to be

Steps to Reproduce 🕹

https://codesandbox.io/s/blazing-resonance-oqiso?file=/src/Demo.js

Context 🔦

Discovered this working on material-ui-popup-state demos.

Your Environment 🌎

Refer to code sandbox for versions

Metadata

Metadata

Assignees

No one assigned

    Labels

    breaking changecomponent: menuThis is the name of the generic UI component, not the React module!design: materialThis is about Material Design, please involve a visual or UX designer in the process

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions