question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[MenuItem] background-color can't override due to specificity

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

Expected Behavior

MenuItem can override selected style.

Current Behavior

MenuItem can’t override selected style due to specificity. see: https://github.com/mui-org/material-ui/blob/7fdc1890fb744b565480835fd5684e66871c679f/packages/material-ui/src/MenuItem/MenuItem.js#L20-L22

Steps to Reproduce

Link: https://codesandbox.io/s/6v2kolp19n

Context

In my case, I override selected style with createMuiTheme function, so no problem for me. but it might be helpful to someone.

I’ll make a PR with removing &$selected property and copying to selected property as default css.

Thank you for taking time.

Your Environment

Tech Version
Material-UI v1.4.0
React
browser
etc.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
oliviertassinaricommented, Oct 4, 2018
1reaction
oliviertassinaricommented, Jul 21, 2018

I’m happy to share the vision 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

[MenuItem] background-color can't override due to specificity
In my case, I override selected style with createMuiTheme function, so no problem for me. but it might be helpful to someone. I'll...
Read more >
How to override Material-UI MenuItem selected background ...
A workaround could be to apply the appropriate background color in the root css according to the selected state and to not use...
Read more >
How to override Material-UI MenuItem selected background ...
[Solved]-How to override Material-UI MenuItem selected background color?- ... Mui-selected The specificity of those two classes is taking priority over the ...
Read more >
issue with styling a menuBar's background color? — oracle-tech
Hello all, I have been trying to style a menuBar but it seems I'm either not doing it correctly, or it's not working....
Read more >
How can I style each nav menu item to have different ...
Is there an easy way to change the background color and hover colors for EACH menu item? It seems I can only change...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found