Skip to content

The design language that makes your AI harness better at design.

JavaScript

See through versioned stylesheets and catch standard-tracked kickers

Paul Bakauscfb6274a180f
diff --git a/cli/engine/detect-antipatterns-browser.js b/cli/engine/detect-antipatterns-browser.js
index 5266535c3..cb830c3dc 100644
--- a/cli/engine/detect-antipatterns-browser.js
+++ b/cli/engine/detect-antipatterns-browser.js
@@ -3324,7 +3324,11 @@ function isKickerCandidate(opts) {
|| isSmallCaps;
if (!isUppercased) return false;
if (!(kickerFontSize > 0 && kickerFontSize <= 14)) return false;
- const minTrackedSpacing = Math.max(1, kickerFontSize * 0.08);
+ // Proportional only, no absolute floor: the wild's most common recipe is
+ // 0.08em at a sub-13px size, which computes to under 1px and sailed past
+ // the old Math.max(1, ...) floor (observed live: a page whose kickers were
+ // literally class="kicker" produced zero findings).
+ const minTrackedSpacing = kickerFontSize * 0.06;
if (!(kickerLetterSpacing >= minTrackedSpacing)) return false;
return true;
}
diff --git a/cli/engine/engines/static-html/css-cascade.mjs b/cli/engine/engines/static-html/css-cascade.mjs
index 939eed779..60e10342c 100644
--- a/cli/engine/engines/static-html/css-cascade.mjs
+++ b/cli/engine/engines/static-html/css-cascade.mjs
@@ -952,7 +952,10 @@ function collectStaticCssText(root, fileDir, profile, filePath, modules) {
const rel = link.attribs?.rel || '';
const href = link.attribs?.href || '';
if (!/\bstylesheet\b/i.test(rel) || !href || /^(https?:)?\/\//i.test(href)) continue;
- const cssPath = path.resolve(fileDir, href);
+ // Cache-busting hrefs (styles.css?v=3) resolve to the file, not to a
+ // literal path with the query in it; a versioned link otherwise made the
+ // whole stylesheet invisible to every element-level check.
+ const cssPath = path.resolve(fileDir, href.split(/[?#]/)[0]);
try {
const css = profileStep(profile, {
engine: 'static-html',
diff --git a/cli/engine/rules/checks.mjs b/cli/engine/rules/checks.mjs
index 3abf2758e..12a89675a 100644
--- a/cli/engine/rules/checks.mjs
+++ b/cli/engine/rules/checks.mjs
@@ -2523,7 +2523,11 @@ function isKickerCandidate(opts) {
|| isSmallCaps;
if (!isUppercased) return false;
if (!(kickerFontSize > 0 && kickerFontSize <= 14)) return false;
- const minTrackedSpacing = Math.max(1, kickerFontSize * 0.08);
+ // Proportional only, no absolute floor: the wild's most common recipe is
+ // 0.08em at a sub-13px size, which computes to under 1px and sailed past
+ // the old Math.max(1, ...) floor (observed live: a page whose kickers were
+ // literally class="kicker" produced zero findings).
+ const minTrackedSpacing = kickerFontSize * 0.06;
if (!(kickerLetterSpacing >= minTrackedSpacing)) return false;
return true;
}
diff --git a/tests/detect-antipatterns-fixtures.test.mjs b/tests/detect-antipatterns-fixtures.test.mjs
index bdda86a94..eaf65b7fb 100644
--- a/tests/detect-antipatterns-fixtures.test.mjs
+++ b/tests/detect-antipatterns-fixtures.test.mjs
@@ -915,6 +915,7 @@ describe('detectHtml — hero-eyebrow-chip', () => {
describe('detectHtml — kicker-above-heading', () => {
const SHOULD_FLAG = [
'A Single Kicker Still Flags',
+ 'Standard Tracking Kicker',
'Kicker Above An H3',
'Kicker Above An H4',
'Sub Hero Heading',
diff --git a/tests/fixtures/antipatterns/kicker-above-heading.html b/tests/fixtures/antipatterns/kicker-above-heading.html
index a301f147b..6c9f2113b 100644
--- a/tests/fixtures/antipatterns/kicker-above-heading.html
+++ b/tests/fixtures/antipatterns/kicker-above-heading.html
@@ -43,6 +43,19 @@
.pass-kicker-caps {
text-transform: uppercase;
}
+ /* The wild's most common kicker recipe: 0.08em tracking at a sub-13px
+ size computes to under 1px, which the old absolute floor excluded. */
+ .tight-tracked-kicker {
+ display: block;
+ width: 240px;
+ min-height: 16px;
+ margin: 0 0 8px;
+ font-size: 12px;
+ line-height: 16px;
+ letter-spacing: 0.08em;
+ text-transform: uppercase;
+ color: #5b5046;
+ }
.smallcaps-kicker {
display: block;
width: 240px;
@@ -187,6 +200,12 @@
<p>One tracked uppercase label above one heading is enough. No repetition required.</p>
</section>
+ <section class="case">
+ <span class="tight-tracked-kicker">Output model</span>
+ <h2>"Standard Tracking Kicker"</h2>
+ <p>Uppercase at 12px with 0.08em tracking is the most common authored kicker and must flag.</p>
+ </section>
+
<section class="case">
<p class="kicker">Preview sequence</p>
<h3>"Kicker Above An H3"</h3>