You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Check if updating to the latest Preact version resolves the issue
Describe the bug
Compiled style can be incorrect if there are css values present
To Reproduce
Let's say you have the following component
constComponent=()=>{const[foo,setFoo]=useState(false)return(<buttononClick={()=>setFoo(val=>!val)}style={{background: foo ? 'red' : undefined,"--font-family": 'Hevetica'}}>
Test
</button>)
Expected behavior
You'd imagine that if you click on the button multiple times, it'd switch between being red and transparent.
However, on the third render, in the compiled style string, the background property will be placed after the --font-family variable and thus ignored, making it always transparent.
The easiest fix is to pass any value other than underined, eg: background: foo ? 'red' : 'none';
However, it is pretty counterintuitive. :)
The text was updated successfully, but these errors were encountered:
However, on the third render, in the compiled style string, the background property will be placed after the --font-family variable and thus ignored, making it always transparent.
Are you referring to the fact that the style string will become "--font-family: Hevetica; background: red;", rather than "background: red; --font-family: Hevetica;" when toggled? If so, that's the way the style interface works, I'm not sure we can reasonably guarantee ordering there.
Describe the bug
Compiled style can be incorrect if there are css values present
To Reproduce
Let's say you have the following component
Expected behavior
You'd imagine that if you click on the button multiple times, it'd switch between being red and transparent.
However, on the third render, in the compiled style string, the
background
property will be placed after the--font-family
variable and thus ignored, making it always transparent.The easiest fix is to pass any value other than underined, eg:
background: foo ? 'red' : 'none';
However, it is pretty counterintuitive. :)
The text was updated successfully, but these errors were encountered: