Skip to content

[TreeView] no selected background color applied on mobile device #20311

@tonyhallett

Description

@tonyhallett
  • 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 😯

There is no selected background color for a selected tree item.

Expected Behavior 🤔

There is selected background color for a selected tree item.

Steps to Reproduce 🕹

https://codesandbox.io/s/wizardly-maxwell-e7mmk

Steps:

  1. Select item

https://github.com/mui-org/material-ui/blob/81c20b849f7aeddb4004ed215d80f7ca609354c1/packages/material-ui-lab/src/TreeItem/TreeItem.js#L32

export const styles = (theme) => ({
  /* Styles applied to the root element. */
  root: {
    listStyle: 'none',
    margin: 0,
    padding: 0,
    outline: 0,
    WebkitTapHighlightColor: 'transparent',
    '&:focus > $content $label': {
      backgroundColor: theme.palette.action.hover,
    },
    '&$selected > $content $label': {
      backgroundColor: fade(theme.palette.primary.main, theme.palette.action.selectedOpacity),
    },
    '&$selected > $content $label:hover, &$selected:focus > $content $label': {
      backgroundColor: fade(
        theme.palette.primary.main,
        theme.palette.action.selectedOpacity + theme.palette.action.hoverOpacity,
      ),
      // Reset on touch devices, it doesn't add specificity
      '@media (hover: none)': {
        backgroundColor: 'transparent',//******************************************
      },
    },
  },

Metadata

Metadata

Assignees

No one assigned

    Labels

    scope: tree viewChanges related to the tree view. This includes TreeView, TreeItem.type: bugIt doesn't behave as expected.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions