Material-ui: Inherited styles overriding the component styles

Created on 7 Jun 2019  路  4Comments  路  Source: mui-org/material-ui

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

Expected Behavior 馃


image
The header class .MuiAppBar-colorPrimary should override .MuiPaper-root and hence show blue color instead of white.

Current Behavior 馃槸


image
MuiPaper-root is overiding .MuiAppBar-colorPrimary.

Steps to Reproduce 馃暪


I would try to reproduce it and edit this. I thought someone might have idea whats going on.

Context 馃敠


I have single app root, no jss code etc. The only extra dependency apart from default react-material stack is unstated. I see double .MuiPaper-root class, may be something is off there.
Also I haven't used even themeprovider tag or baseline anywhere

Your Environment 馃寧

| Tech | Version |
|--------------|---------|
| Material-UI | v4.0.1 |
| React |^16.8.6 |
| Browser |Chrome|
|material-table| 1.38.0|

Most helpful comment

Thanks to #15610 I found the problem
The problem seems to lie here.
import Paper from '@material-ui/core/Paper/Paper';
changing to this removed the issue.
import Paper from '@material-ui/core/Paper';
feel free to close :)

All 4 comments

This issue might be related with https://github.com/mui-org/material-ui/issues/16100
Can you please screenshot how styles look like within your <head>? No matter what classes are used by the html elements, when at the same level of specificity, it all depends on the which rules are rendered the first and the latter ones will always override the former ones.

Thanks to #15610 I found the problem
The problem seems to lie here.
import Paper from '@material-ui/core/Paper/Paper';
changing to this removed the issue.
import Paper from '@material-ui/core/Paper';
feel free to close :)

@dereksangshi if you still want the screenshot:
image

Thanks for this issue, for us the problem was importing Paper like this

import Paper from '@material-ui/core/Paper/index';

It took me several hours of debugging because the import was done in another component

Was this page helpful?
0 / 5 - 0 ratings

Related issues

zabojad picture zabojad  路  3Comments

revskill10 picture revskill10  路  3Comments

anthony-dandrea picture anthony-dandrea  路  3Comments

mattmiddlesworth picture mattmiddlesworth  路  3Comments

activatedgeek picture activatedgeek  路  3Comments