[jss-vendor-prefixer] CSS Grid and Vendor prefix
Expected behavior: Hello When using CSS Grid with recat-jss I expect that Vendor prefix will kick in i IE and add the -ms prefix to some of the CSS Grid properties.
Describe the bug: Here is an example:
'& .head-section': {
display: 'grid',
gridTemplateColumns: '1fr 1fr 240px',
gridRow: props => props.notificationSection ? '2' : '1',
gridColumn: '1 / span 2'
padding: '0 30px',
}
This works fine in Chrome or Firefox. In IE 11 however, I see the following css rules in developer tools:
display: -ms-grid;
-ms-grid-colum: 1 / span 2;
grid-template-columns: 1fr 1fr 240px;
grid-row: 2;
Notice that only the display property has correct propertyname and value. The other properties are flagged red in IE dev tools and are not applied.
According to Autoprefix, the other values should be pared like this for IE:
display: -ms-grid;
-ms-grid-colum: 1;
-ms-grid-column-span: 2;
ms-grid-columns: 1fr 1fr 240px;
ms-grid-row: 2;
Is there any reason for this behavior?
Codesandbox link:
Versions (please complete the following information):
- react-jss: 8.6.1
- Browser [e.g. chrome, safari]: IE 11
- OS [e.g. Windows, macOS]: Windows
Can you please provide a codesandbox with a minimal reproducible example?
Also in your correct behavior, there is one more property than in the source. Where does the -ms-grid-column-span come from?
@HenriBeck unable to run codesanbox in IE 11, but this is an example i made https://codesandbox.io/s/k08mv8790o
The following rule suggests that a container starts at column 1 and spans 2 columns. The -ms equivalent to this are 2 separate rules:
grid-column: 1 / span 2;
-ms-grid-column: 1;
-ms-grid-column-span: 2;

Not sure if we can fix that. I think the way we are currently auto-prefixing is trying to add the property; if the property is still being returned by getDynamicStyles we are using that property, otherwise, we go through the possible prefixes and try them.
Explicitly defining the ms rules in jss file seems to be working. But do you think this is a solid solution / workaround for now?
I will end up with something like this:
display: 'grid',
msGridColumns: '1fr 1fr 240px',
msGridRow: props => props.notificationSection ? '2' : '1',
msGridColumn: '1',
msGridColumnSpan: '2',
gridTemplateColumns: '1fr 1fr 240px',
gridRow: props => props.notificationSection ? '2' : '1',
gridColumn: '1 / span 2'
This needs a bug fix/enhancement in css-vendor package cc @AleshaOleg
I will take care of this issue this week thanks!
Any update here?
Any updates ?
i've found the solution: '-ms-grid-column': 1, ... For same item but using other selector, It allows to prevent jss from replacing '-ms-...' rules in same selector.
I will take care of this issue this week thanks! @AleshaOleg
Is this issue still under progress?