Skip to content

MenuItem right icons are not styleable if desktop=false #2566

@birnam

Description

@birnam

https://github.com/callemall/material-ui/blob/master/src/menus/menu-item.jsx#L168-L172

if (rightIcon) {
  const mergedRightIconStyles = desktop ?
    this.mergeStyles(styles.rightIconDesktop, rightIcon.props.style) : null;
  rightIconElement = React.cloneElement(rightIcon, {style: mergedRightIconStyles});
}

In MenuItem when merging styles.rightIconDesktop with rightIcon.props.style, the merge only happens if desktop == true, otherwise it sets it to null. If desktop == false it should at least preserve the style property the developer provided for the rightIcon.

if (rightIcon) {
  const mergedRightIconStyles = desktop ?
    this.mergeStyles(styles.rightIconDesktop, rightIcon.props.style) : rightIcon.props.style;
  rightIconElement = React.cloneElement(rightIcon, {style: mergedRightIconStyles});
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bugIt doesn't behave as expected.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions