New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[styles] Document the CSS prefixing strategy on the server #14139
[styles] Document the CSS prefixing strategy on the server #14139
Conversation
Did you check the git history? I think that we should add a comment but keep this prefixes. |
Sure did. It was added in #10063. In the same PR the It should still result in CSS with the required prefixes in the client and on the server (looks good on https://deploy-preview-14139--material-ui.netlify.com/demos/buttons/). The PR didn't mention why we need to add the prefix in this case so if there is a reason we should add a comment. Otherwise this looks fine to me now since no regression test failed. |
@eps1lon From what I recall, they were two issues. One important, one less. The important issue is that JSS doesn't do prefixes on the server. inputs and buttons without the appearance prefix looks really bad. The second issue what with the error reported by https://validator.w3.org/. |
|
@eps1lon It's a tradeoff, adding the appearance is a low overhead fix that prevents layout jumps on Chrome, latest version. Same problem with the old browsers and the flex prefixes. |
I just proofed to you with my second point that it's not. Where did you get the screenshot from? https://deploy-preview-14139--material-ui.netlify.com/demos/selects/ doesn't look like this with disabled javascript. Also the source you linked is from an alpha package that introduces a breaking change over our current documented solution.
Based on what? I always here this "opinionated" argument but it seems like this is only used when it's convenient. How do you ensure that (if this would be the case) other occurrences of non-prefixed css props don't cause a layout jump as well? I'm ok with adding a note to the docs that you should pipe the css through |
@eps1lon You can't use the material-ui documentation as a baseline here. We are using https://autoprefixer.github.io/ to work around the issue in the documentation. I doubt a lot of our users use a server side CSS prefixer given the performance overhead and the extra time needed to set this up. At onepixel, we only use it for cached requests.
Yes, it's opinionated, it's based on the idea that Chrome latest version market share is x10 of what the browsers that don't support flex prefixes have. |
I don't follow the argument that reduces vendor prefixes to flexbox support and chrome. Did some more research and it seems like that no browser support for the I would move to an additional note about browser support on the server. It's currently not obvious that some features related to CSS might not be supported for server side rendering. |
I'm happy to see Gatsby doing it :). What makes you think using next-css makes autoprefixing easy?
I agree, I think that it would be great to document cssinjs/jss#279. |
Regarding the flexbox, I believe that doing the prefixes by hand is x10 more costly than what we have for the appearance as it's used more often and the prefixes aren't trivial. Flexbox yields x10 less value as affect way fewer browsers. We can extend this logic to the other CSS properties we need to prefix that impact might be noticed between the first server side paint and the client side rehydration. |
I retract that statement. Have to make a lot of assumptions and with the current landscape of styling solution I would need to do some more research. It just "seemed" that way since they had |
aa20abc
to
0943473
Compare
0943473
to
4d1dd4d
Compare
Switch to standard CSS properties wherever the same values are used.
jss-plugin-vendor-prefixer
will do the rest.