wix / stylable

Stylable - CSS for components
https://stylable.io
MIT License
1.27k stars 62 forks source link

cannot define pseudo states inside complex selectors #360

Closed lbelinsk closed 6 years ago

lbelinsk commented 6 years ago

I am trying to put states on some element which is not the root element.

image

image

Maybe I am doing something wrong, but this works for me only if I remove the ".root" it works:

image

This is not just a warning, I can't see my component at all when this error occurs.

tomrav commented 6 years ago

Is .progressBar a local class in this case? if it is, then it is already scoped to your stylesheet and does not require additional .root scoping.

lbelinsk commented 6 years ago

.progressBar is the grandchild of root, yes. Isn't there a boolean we can config for root scoping? What if it was false?

tomrav commented 6 years ago

Root scoping is already defaulted to false, that's why you're getting warnings like unscoped native element ".someClass" will affect all elements of the same type in the document.

In your case (I'm assuming, without seeing the entire stylesheet), your .root class was just not needed (increasing specificity for no reason). The warning about defining states in complex selectors (which, .root .x is) is also intended as that's what's currently supported by Stylable.

lbelinsk commented 6 years ago

Ok, thanks. From my side, you can close the issue.