Invalid CSS output from function based dynamic styles
See original GitHub issueCurrent behavior:
Using an array of styles leads to invalid CSS properties in the DOM named label
, name
, and styles
.
On the first style passed, the invalid CSS prop label
does not appear in the DOM, but for subsequent styles it does. Additionally the first rule in the CSS in each style passed is nested invalidly like so: styles: color: red;
To reproduce:
Can’t reproduce this issue on CodeSandbox - so possibly related to I get this issue whether I use the plugin or not.babel
or webpack
would be my guess. Does the order of babel
plugins matter when including the emotion
plugin?
Expected behavior:
No invalid props in the DOM and the first rule is not mangled and ignored.
Environment information:
react
version:16.9.0
emotion
version:10.0.17
Issue Analytics
- State:
- Created 4 years ago
- Comments:24 (21 by maintainers)
Top Results From Across the Web
Make Your CSS Dynamic with CSS Custom Properties - Toptal
Explore CSS custom properties and find out how they can be used to make better, more dynamic stylesheets.
Read more >How to set the CSS from Javascript of a dynamic data
The following code should work if a is the correct element (difference with your code being "style" instead of "styles" and encapsulating ...
Read more >Enables functions for dynamic styles - JSS
If you want dynamic behavior for your Style Sheet, you can use functions as a value which return the actual value or a...
Read more >A Complete Guide to CSS Functions
Like any other programming language, CSS has functions. They can be inserted where you'd place a value, or in some cases, ...
Read more >Using CSS custom properties (variables) - MDN Web Docs
Each CSS property can be assigned a defined set of values. If you try to assign a value to a property that is...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Just encountered this problem while migrating from v9 to v11. Removing
emotion
from babel plugins fixed it for me as I already have@emotion/babel-preset-css-prop
in babel presets.Unfortunately, nothing comes to my mind as to what we could do to warn about smth like this.