mui-x icon indicating copy to clipboard operation
mui-x copied to clipboard

[DataGrid] Custom sort icon looks like it is selected, when there is no sort

Open jessq opened this issue 5 years ago • 3 comments

With the default icon, on hover, the sort icon will fade-in. If I use a custom icon, the fade-in does not work. It will just show the icon at full opacity, as if it is selected.

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

Expected Behavior 🤔

The custom icon should have opacity 0 and fade-in on hover when no sort is selected.

Steps to Reproduce 🕹

https://codesandbox.io/s/pedantic-kowalevski-jb5pb

Steps:

  1. Go to the Codesandbox link. Notice how the icon is at full opacity.

Context 🔦

This is a breaking user experience bug.

Your Environment 🌎

System: OS: macOS 10.15.7 Binaries: Node: 12.16.1 - /usr/local/bin/node Yarn: 1.22.10 - /usr/local/bin/yarn npm: 7.6.2 - /usr/local/bin/npm Browsers: Chrome: 91.0.4472.114 Edge: Not Found Firefox: 88.0 Safari: 14.0.2 npmPackages: @emotion/styled: 10.0.27 @material-ui/core: ^4.11.2 => 4.11.2 @material-ui/icons: ^4.9.1 => 4.9.1 @material-ui/lab: ^4.0.0-alpha.46 => 4.0.0-alpha.56 @material-ui/pickers: 3.2.10 @material-ui/styles: 4.11.2 @material-ui/system: 4.11.2 @material-ui/types: 5.1.0 @material-ui/utils: 4.10.2 @material-ui/x-grid: ^4.0.0-alpha.25 => 4.0.0-alpha.32 @material-ui/x-license: 4.0.0-alpha.32 @types/react: ^16.9.23 => 16.9.38 react: ^17.0.0 => 17.0.0 react-dom: ^17.0.0 => 17.0.0 typescript: ^4.1.3 => 4.1.3

`npx @material-ui/envinfo`
  Don't forget to mention which browser you used.
  Output from `npx @material-ui/envinfo` goes here.

Order id 💳

#22665

jessq avatar Jun 29 '21 04:06 jessq

For me the issue here is that you don't pass the props to the icon

Fixed example : https://codesandbox.io/s/empty-sound-wn8xj Documentation : https://material-ui.com/components/data-grid/components/#overriding-components

flaviendelangle avatar Jun 29 '21 10:06 flaviendelangle

+1 for closing with https://material-ui.com/guides/composition/.

oliviertassinari avatar Jun 29 '21 11:06 oliviertassinari

I have updated the title and labels to make it easier for future developers to understand what this issue is about.

oliviertassinari avatar Jun 30 '21 23:06 oliviertassinari