BlazorStyled
BlazorStyled copied to clipboard
Nested selectors do not work if they are the only rule
I have to Styled-Elements in my source code:
<Styled @bind-Classname="@hideBody">
& .ant-card-body {
display: none;
}
</Styled>
<Styled @bind-Classname="@root" ComposeHideBody="@hideBody" ComposeHideBodyIf="@(!_edit)">
margin: 5px;
</Styled>
If the field _edit is set to true, display: none should be applied to the descendant with the class name ant-card-body, which is not happening with the code above. But when I add another rule to the first Styled element it suddenly works as I expected it to:
<Styled @bind-Classname="@hideBody">
color: red;
& .ant-card-body {
display: none;
}
</Styled>
<Styled @bind-Classname="@root" ComposeHideBody="@hideBody" ComposeHideBodyIf="@(!_edit)">
margin: 5px;
</Styled>
Thanks for reporting this.
I was a bit stuck unable to compile my project due to a bug i reported to the asp dot net project but a work around was just posted there so hopefully I can fix this and get a build out this weekend (assuming the workaround works)
I've also encountered this issue, workaround that I'm currently using is to add a leading empty statement (;).
@chanan Thanks for you fast response and your work on this project of course! @andersstorhaug Thanks I'll use that for the moment :)