From 30d1e06a75bc1b6065eb26f774ccbaa09806d221 Mon Sep 17 00:00:00 2001 From: Paul Bakaus Date: Tue, 7 Apr 2026 19:35:33 -0700 Subject: [PATCH] Detect side-tab borders on modern color formats and label cards - Fix isNeutralColor to handle oklch, oklab, lch, lab, hsl, and hwb with format-specific chroma/saturation thresholds. jsdom returns these formats literally, so the previous rgb-only regex caused every modern-format border color to be silently treated as neutral and skipped by checkBorders. - Flip the unknown-format fallback from neutral to colored, so unrecognized color strings err on the side of detection. - Introduce a narrower BORDER_SAFE_TAGS set (SAFE_TAGS minus 'label') used only by the border checks. Card-shaped clickable labels with thick colored side borders are now detected, while colors, motion, and nested-card checks continue to skip labels to avoid false positives on real form labels. - Add tests/fixtures/antipatterns/modern-color-borders.html with 8 flag cases (oklch x3, oklab, lch, lab, plus 2 label cards) and 10 pass cases (neutrals across formats, plain inline labels, thin/neutral-bordered labels, colored-on-all-sides). Reproducer (preop-portal demo): side-tab findings rise from 0 to 12. --- src/detect-antipatterns-browser.js | 66 ++++- src/detect-antipatterns.mjs | 66 ++++- tests/detect-antipatterns-fixtures.test.mjs | 37 +++ .../antipatterns/modern-color-borders.html | 235 ++++++++++++++++++ 4 files changed, 394 insertions(+), 10 deletions(-) create mode 100644 tests/fixtures/antipatterns/modern-color-borders.html diff --git a/src/detect-antipatterns-browser.js b/src/detect-antipatterns-browser.js index e181ccb08..3162f43e7 100644 --- a/src/detect-antipatterns-browser.js +++ b/src/detect-antipatterns-browser.js @@ -48,6 +48,18 @@ const SAFE_TAGS = new Set([ 'rect', 'line', 'polyline', 'polygon', 'g', 'defs', 'use', ]); +// Per-check safe-tags override for the border (side-tab / border-accent) +// rule. We intentionally re-allow