-
-
Notifications
You must be signed in to change notification settings - Fork 396
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
[react-jss] - when generating classes, it does not handle spaces correctly #938
Comments
Its a bug. JSS core expects that classNamePrefix is a valid class name, react-jss uses the displayName with assumption it is an alternative to class component name or function name, which would be valid as well (https://reactjs.org/docs/react-component.html#displayname) ... so its kinda an edge case that some folks use it with arbitary strings with spaces. To fix this we would need to export the escaping function from the core and use it in react-jss. |
Also it won't be a problem in production, since we don't pass it. So we should only escape it in dev mode as well. |
Fixed in master, will be released in V10 |
@kof I updated https://codesandbox.io/s/4jpxqn76ow to start using v10 but issue still exists. |
The identifier is correctly being escaped, the rule just isn't correctly applied. It is not possible to apply css rules which have a space inside. See: https://cs50.stackexchange.com/questions/4309/can-you-have-a-css-class-name-with-a-space |
Space is a valid css token that separates multiple class names, if you have a space in the class of the element it's considered as 2 classes |
@kof and @HenriBeck when developer is using |
Yeah, we should just replace space with a dash. |
Implemented in #1049 |
Expected behavior:
When Component's displayName has a space, then injected styles should apply correctly.
Describe the bug:
When Component's displayName has a space, then injected styles do not apply correctly.
Codesandbox link:
https://codesandbox.io/s/4jpxqn76ow
Versions (please complete the following information):
Feel free to add any additional versions which you may think are relevant to the bug.
The text was updated successfully, but these errors were encountered: