CSS shorthand properties do not work well when styles are overwritten
Steps
I'm using the Divider component and want to change the default CSS margin to another value.
In marginStyles.tsx, the default margin is set using marginTop and marginBottom, like this:
const dividerStyles = {
root: (): => ({
marginTop: pxToRem(5 + size * 7.5),
marginBottom: pxToRem(5 + size * 7.5),
}),
}
What I did was to overwrite the margin using margin CSS shorthand like this:
<Divider styles={{ root: { margin: 0 }}} />
Expected Result
The Divider margin is overwritten to 0.
Actual Result
The Divider margin is not overwritten. We are using shorthand margin in order to attempt that but our mechanism merges the Provider componentStyles and the component's styles JS objects together so margin property cannot override a different property (marginTop or marginBottom in our case).
To unblock the user, the correct way to override CSS margin in this case is:
<Divider styles={{ root: { marginTop: 0, marginBottom: 0 }}} />
However, this is undesirable and we should come up with better merging strategy for CSS in JS.
Version
0.5.2
CSS shorthand properties do not work well when styles are overwritten
Steps
I'm using the
Dividercomponent and want to change the default CSSmarginto another value.In
marginStyles.tsx, the default margin is set usingmarginTopandmarginBottom, like this:What I did was to overwrite the margin using
marginCSS shorthand like this:Expected Result
The
Dividermargin is overwritten to0.Actual Result
The
Dividermargin is not overwritten. We are using shorthandmarginin order to attempt that but our mechanism merges theProvidercomponentStylesand the component'sstylesJS objects together somarginproperty cannot override a different property (marginTopormarginBottomin our case).To unblock the user, the correct way to override CSS
marginin this case is:However, this is undesirable and we should come up with better merging strategy for CSS in JS.
Version
0.5.2