BlazorStyled icon indicating copy to clipboard operation
BlazorStyled copied to clipboard

Nested selectors do not work if they are the only rule

Open Cedware opened this issue 5 years ago • 3 comments

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>

Cedware avatar Aug 21 '20 13:08 Cedware

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)

chanan avatar Aug 21 '20 13:08 chanan

I've also encountered this issue, workaround that I'm currently using is to add a leading empty statement (;).

andersstorhaug avatar Aug 22 '20 06:08 andersstorhaug

@chanan Thanks for you fast response and your work on this project of course! @andersstorhaug Thanks I'll use that for the moment :)

Cedware avatar Aug 22 '20 14:08 Cedware