The resulting styles when using the Box component with the clone attribute are created differently in production than they are in development mode.
Ideally the Box component would be able to override styles in production mode like it does in development, but at the very least it should be the same in both modes.
With the current limbo of jss and possible conversion to a different css-in-js library (https://github.com/mui-org/material-ui/issues/16947) I have been trying to use the Box component as much as possible to reduce the amount of change needed if material-ui decides to change. So it would be best if the Box component was able to override original styles, and behave consistently between environments.
[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.
The resulting styles are created differently in production than they are in development mode, with the production mode not allowing the Box component using the clone attribute to override already defined styles like background-color.
Production: Card has white backgroundDevelopment: Card has Purple Background
Expected Behavior π€
It should work the same in production as it does in develop, with the <Box clone bgcolor="primary.main"> overriding the child component <Card>'s (or any other material component's) original styles.
Production: Card has Purple BackgroundDevelopment: Card has Purple Background
Steps to Reproduce πΉ
Steps:
Use the Box component with the clone attribute to override a style on a material-ui component like the Card.
Override a style like bgcolor which is already defined on the child component.
I'm trying to rely more on the Box component instead of makeStyles because of the uncertain future of jss. Also I'm starting to prefer the ease of use that comes with the Box component and its helper shortcuts. But when trying to add styles to existing components it isn't always consistent in its behavior.
The resulting styles when using the
Box
component with theclone
attribute are created differently in production than they are in development mode.Ideally the
Box
component would be able to override styles in production mode like it does in development, but at the very least it should be the same in both modes.With the current limbo of jss and possible conversion to a different css-in-js library (https://github.com/mui-org/material-ui/issues/16947) I have been trying to use the
Box
component as much as possible to reduce the amount of change needed if material-ui decides to change. So it would be best if theBox
component was able to override original styles, and behave consistently between environments.Seems related to https://github.com/mui-org/material-ui/issues/16609 , but that was already closed.
Current Behavior π―
The resulting styles are created differently in production than they are in development mode, with the production mode not allowing the
Box
component using theclone
attribute to override already defined styles likebackground-color
.Production: Card has white background Development: Card has Purple Background
Expected Behavior π€
It should work the same in production as it does in develop, with the
<Box clone bgcolor="primary.main">
overriding the child component<Card>
's (or any other material component's) original styles.Production: Card has Purple Background Development: Card has Purple Background
Steps to Reproduce πΉ
Steps:
Box
component with the clone attribute to override a style on a material-ui component like theCard
.bgcolor
which is already defined on the child component.Code:
Dev Output:
Prod Output:
Here you can see the dev build: https://codesandbox.io/s/quizzical-dew-fi3qw
Here you can see the prod build: http://codyschaaf.com/box-demo/
(prod repo: https://github.com/CodySchaaf/box-demo)
Context π¦
I'm trying to rely more on the
Box
component instead ofmakeStyles
because of the uncertain future ofjss
. Also I'm starting to prefer the ease of use that comes with theBox
component and its helper shortcuts. But when trying to add styles to existing components it isn't always consistent in its behavior.Your Environment π