Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect style inheritance with ID selector when additional class is missing #637

Open
NipponSunrise opened this issue Sep 30, 2024 · 1 comment

Comments

@NipponSunrise
Copy link

NipponSunrise commented Sep 30, 2024

There is an issue with CSS where an element with an id is incorrectly inheriting styles meant for an additional class, even when that class is not present. In the example below, the label should only apply the styles defined by #myLabel.baseClass, but it seems to inherit styles defined for #myLabel.baseClass.i18n_en even though the i18n_en class is not applied.

The issue seems to be related to the use of the id selector in combination with class selectors. When using id selectors, the styles from more specific rules appear to "leak" into the element even when the additional class is not applied. This issue does not occur if the id is removed from the selector.

<vbox style="padding: 5px;">
    <style>
      #myLabel.baseClass {
        color: yellow;
      }

      #myLabel.baseClass.i18n_en {
        color: green;
      }

    </style>
    
    <label styleName="baseClass" id="myLabel" text="I have to be yellow, but I'm green" />

</vbox>

Expected Behavior

The label should apply the styles from #myLabel.baseClass, and the text color should be yellow.

Current Behavior

The label inherits the styles from #myLabel.baseClass.i18n_en (where the color is green) even though the i18n_en class is not applied to the label.

Steps to Reproduce (for bugs)

http://haxeui.org/builder/?0f2638a3

Your Environment

v1.7 and official playground

@ianharrigan
Copy link
Member

hmmmm, oh, thats weird - ill have to check the code, but my guess that as soon as it hits the match on the the .baseClass, it decides "thats good enough" - not sure.

Cheers,
Ian

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants