Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ListItem doesn't lose focus when mouse out after click #14673

Closed
2 tasks done
xs9627 opened this issue Feb 26, 2019 · 3 comments
Closed
2 tasks done

ListItem doesn't lose focus when mouse out after click #14673

xs9627 opened this issue Feb 26, 2019 · 3 comments
Labels
bug 🐛 Something doesn't work good first issue Great for first contributions. Enable to learn the contribution process.

Comments

@xs9627
Copy link
Contributor

xs9627 commented Feb 26, 2019

  • This is not a v0.x issue.
  • I have searched the issues of this repository and believe that this is not a duplicate.

Expected Behavior 🤔

ListItem should lose focus after mouse out.

Current Behavior 😯

Still focused after mouse out

Steps to Reproduce 🕹

Link:
Compare from v3.9.0 to v3.9.2.
https://imgur.com/a/r0jpijj

Context 🔦

Your Environment 🌎

Tech Version
Material-UI v3.9.2
React 16.8.3
Browser Chrome Version 72.0.3626.109
TypeScript /
etc. MacOS Version 10.14.3
@oliviertassinari oliviertassinari added the bug 🐛 Something doesn't work label Feb 26, 2019
@oliviertassinari
Copy link
Member

@xs9627 Thank you for the report, the regression was introduced in #14212. We should be able to fix it by removing the unterlated focus style changes of the pull request, we should have keep it isolated to the key handling:

--- a/packages/material-ui/src/ListItem/ListItem.js
+++ b/packages/material-ui/src/ListItem/ListItem.js
@@ -20,7 +20,7 @@ export const styles = theme => ({
     textAlign: 'left',
     paddingTop: 11, // To use 10px in v4
     paddingBottom: 11, // To use 10px in v4
-    '&$selected, &$selected:hover, &$selected:focus': {
+    '&$selected, &$selected:hover': {
       backgroundColor: theme.palette.action.selected,
     },
   },
@@ -28,9 +28,10 @@ export const styles = theme => ({
   container: {
     position: 'relative',
   },
-  // To remove in v4
   /* Styles applied to the `component`'s `focusVisibleClassName` property if `button={true}`. */
-  focusVisible: {},
+  focusVisible: {
+    backgroundColor: theme.palette.action.selected,
+  },
   /* Legacy styles applied to the root element. Use `root` instead. */
   default: {},
   /* Styles applied to the `component` element if `dense={true}` or `children` includes `Avatar`. */
@@ -69,9 +70,6 @@ export const styles = theme => ({
         backgroundColor: 'transparent',
       },
     },
-    '&:focus': {
-      backgroundColor: theme.palette.action.hover,
-    },
   },
   /* Styles applied to the `component` element if `children` includes `ListItemSecondaryAction`. */
   secondaryAction: {

Do you want to submit a pull request? :)

@oliviertassinari oliviertassinari added the good first issue Great for first contributions. Enable to learn the contribution process. label Feb 26, 2019
@leroydev
Copy link

leroydev commented Apr 2, 2019

It's now only fixed in 4.x.x, shouldn't it be fixed in 3.x.x too, considering it's still broken there?
I personally don't think it's reasonable to have people stick to 3.9.0 to fix this bug, as there are already bugfixes available in versions after 3.9.0, and there might be more coming in the future.

@oliviertassinari
Copy link
Member

@leroydev We would be happy to apply the same bug fix on v3.9. We hope to release the first beta release of v4 this weekend.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something doesn't work good first issue Great for first contributions. Enable to learn the contribution process.
Projects
None yet
Development

No branches or pull requests

3 participants