In the new Style Editor BETA feature, which brings CSS-like styling over to UI editing inside studio, I’ve noticed an annoying behavior related to how styles are prioritized.
Here’s an example of the behavior:
In this stylesheet, we have:
- A global tag
.Colored, applying an YELLOW background color to all elements with such tag; - The same tag
.Colored, applying only to Frames, a RED background color; - A nested tag
.GreenColored, inside the global tag.Colored, overriding the parent’s background color style to a GREEN background.
HOWEVER, this information is not enough to determine the actual behavior, making it unpredictable.
There are two result possibilities:
*The text is purely for explanation purposes, focus on BackgroundColor of each element
The Nested tags (or Parent-Child tags) have a well-defined hierarchy: On conflicts, the Child will override behavior from the Parent.
However, that does not happen with siblings: since the tag Frame .Colored is not ancestor nor Descendant of the global tag .Colored, the style is unpredictable and it keeps the changes of the newest-created tag. Which means, the order of creation will dictate what the behavior will be, and not nested logic, making this a critical and dangerous bug, where developers cannot assure the result state of their stylesheets.
Expected behavior
The current StyleSheet behavior already follows the oder of precedence: Class > Tags > Modifiers > States > Name, where Class is the least preferred and Name is the most.
However, StyleSheets FAIL to consider the specificity of selectors, which is the preference over the whole selector (example: Frame.Colored over .Colored, Frame.Colored is more specific since only frames with the .Colored tag are affected).
To learn more about specificity in CSS, see: Article about CSS Specificity
Considering that Frame.Colored is more specific than .Colored, the expected behavior to the example given previously would be:
This should be DEFAULT behavior, and always happen despite the order of creation of the specifiers.
This should be default because, if it was not, the specificity Class.Tag would be literally useless, since .Tag would always override it.
With that, implementing Specificity in the same way CSS does is crucial to have actually predictable style sheets.
A private message is associated with this bug report




