You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
content/hidden-text: a comment before a selector stops a plain hiding rule from applying #684
Summary.content/hidden-text never applies a <style> rule whose selector has a CSS comment before or inside it. parseRules in packages/rules/src/content/hidden-text.ts skips comments while scanning but keeps them in the selector text, so /* Header */ .b is not a bare class selector: the rule is treated as a complex selector and only marks .b as ambiguous. A browser ignores the comment and applies the rule.
Found while fixing #679, on current main and with the #679 branch alike.
Repro (HTTP mode, local fixture):
<style>.a{color:red}/* Section */.b{display:none}</style><pclass="b">Sixty or more characters of ordinary visible paragraph text go here, so the rule has something to flag.</p>
Actual: no finding. Chromium (getComputedStyle) hides .b. The same holds for a comment between the selector and { (.b /* x */ {display:none}).
This errs toward no finding, which is the safe direction for this rule, but section comments between rules are ordinary in hand-written stylesheets, so plainly hidden text goes unreported on those pages. Fixing it will change results on ordinary stylesheets (more findings), so it needs a corpus check before it lands.
Acceptance Criteria
A bare class or id rule preceded by a comment (/* x */ .b{display:none}) is applied, and the repro produces a hidden-text finding.
A comment between the selector and { does not stop the rule from applying.
A selector that is still complex once comments are removed (.a /* x */ .b) is still treated as ambiguous.
The change is measured on a page corpus before merge, with the number of pages whose findings change reported in the PR.
Activity
fix(rules): hidden-text applies a style rule with a comment in its se…
fix(rules): hidden-text applies a style rule with a comment in its se…
docs(rules): stripComments doc says when a space is kept; trim the CH…
fix(rules): hidden-text applies a style rule with a comment in its se…