`sx` prop ignores CSS variable with a valid empty-space as value
Open
Nobody has claimed this yet.
customization: css
external dependency
scope: system
waiting for 👍
- Dominant language
- JavaScript
- Stars
- 99.1k
- Forks
- 32.5k
- Avg merge
- 2d 17h
- Merged PRs (30d)
- 106
Description
Steps to reproduce
Steps:
- Open this link to live example: https://stackblitz.com/edit/github-f4qof1vl?file=src%2FApp.tsx
- 2
<Box>elements are in the page, and both are expected to have a green background
Current behavior
Only the second <Box> has a green background. it uses style attributeinstead ofsx` prop
Expected behavior
<Box sx={{ '--c': ' ' }}> />
should translate to
<div style="--c: ;"></div>
Context
https://css-tricks.com/the-css-custom-property-toggle-trick
Your environment
No response
Search keywords: empty space value
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with src/App.tsx in the linked StackBlitz example and compare the Box using sx with the one using the style attribute. Done when the sx value '--c': ' ' produces the equivalent div style of --c: ; and the reproduction behaves consistently.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 56/100