mirror of
https://github.com/pbakaus/impeccable.git
synced 2026-09-11 21:57:14 +03:00
See through versioned stylesheets and catch standard-tracked kickers
Paul's codex build carried an element literally named class="kicker" and the detector returned one finding. Two independent blind spots: - The linked stylesheet was styles.css?v=3, and the href resolved as a literal path with the query string in it, so the whole sheet was invisible to every element-level check: 1 finding with the link, 18 with the CSS inlined. Hrefs now strip query and hash before resolving. - The kicker gate demanded letter-spacing >= max(1px, 0.08 * size). The wild's most common recipe, 0.08em at 12px, computes to 0.973px and lost to the absolute floor by a fraction. The floor is now purely proportional (0.06 * size), with a fixture case pinning the exact shape that slipped through. With both fixed, the failed codex build scans at 18 findings including its numbered section kickers (numbered-section-labels), side-tab stripe, and grid background. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Fable 5
parent
28af30eff0
commit
cfb6274a18
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user