Your app looks AI-generated. Vincent Van Gogh noticed. An agent skill that finds and fixes AI-looking UI and UX in mobile apps, web apps, and websites.
JavaScript accessibilityagent-skillsagent-skills-toolsagentsagentskillsai-slopclaudeclaude-codeclaude-skillsexpoflutterfrontendionicjetpack-composemobilereact-nativeswiftuiuiuxvibe-coding
fix(detect): do not count CSS backdrop-filter: none as a blur surface (#331)
Alex7cc74d6bfe92
diff --git a/skills/unslop-anything/scripts/detect.js b/skills/unslop-anything/scripts/detect.jsindex ec0e0f3..96648ae 100644--- a/skills/unslop-anything/scripts/detect.js+++ b/skills/unslop-anything/scripts/detect.js@@ -1027,8 +1027,9 @@ const rules = [// Tailwind: backdrop-blur, backdrop-blur-<size> and backdrop-blur-[...]// count as blur surfaces. backdrop-blur-none removes the blur, so it// does not count. backdropFilter in a JS style object counts the same- // way, except backdropFilter: "none".- const all = [...matches(/\.(?:ultraThin|thin|regular|thick|ultraThick)Material\b|<BlurView\b|backdrop-filter|BackdropFilter\(|ImageFilter\.blur|\.glassEffect\(|\bbackdrop-blur(?!-none\b)|\bbackdropFilter\b(?!\s*:\s*["'`]none["'`])/, code)];+ // way, except backdropFilter: "none". CSS `backdrop-filter: none` (and the+ // -webkit- form) removes the blur as well.+ const all = [...matches(/\.(?:ultraThin|thin|regular|thick|ultraThick)Material\b|<BlurView\b|backdrop-filter(?!\s*:\s*none\b)|BackdropFilter\(|ImageFilter\.blur|\.glassEffect\(|\bbackdrop-blur(?!-none\b)|\bbackdropFilter\b(?!\s*:\s*["'`]none["'`])/, code)];// A `-webkit-backdrop-filter` written next to the standard property is// the same blur surface, not a second one (#298): the `backdrop-filter`// inside `-webkit-backdrop-filter` already matches, so a standard@@ -1038,9 +1039,9 @@ const rules = [// prefixed declaration still counts.const surfaces = all.filter((m) => {if (code.slice(m.index - 8, m.index) === "-webkit-") {- return !/(?<!-webkit-)backdrop-filter\s*:[^{}]*$/.test(code.slice(0, m.index - 8));+ return !/(?<!-webkit-)backdrop-filter\s*:(?!\s*none\b)[^{}]*$/.test(code.slice(0, m.index - 8));}- return !/-webkit-backdrop-filter\s*:[^{}]*$/.test(code.slice(0, m.index));+ return !/-webkit-backdrop-filter\s*:(?!\s*none\b)[^{}]*$/.test(code.slice(0, m.index));});return surfaces.length >= 3 ? [surfaces[0].index] : [];},diff --git a/test/detect.test.js b/test/detect.test.jsindex 6bfb54f..778eef6 100644--- a/test/detect.test.js+++ b/test/detect.test.js@@ -2364,6 +2364,50 @@ test("glass-everywhere counts Tailwind backdrop-blur classes", () => {assert.deepStrictEqual(scanSource(withNone, "a.tsx"), []);});+test("glass-everywhere does not count CSS backdrop-filter: none", () => {+ // The repro from issue #321: the stylesheet turns the blur off for print.+ const quiet = [+ ".nav { backdrop-filter: blur(12px); }",+ ".modal { backdrop-filter: blur(20px); }",+ "@media print {",+ " .nav, .modal { backdrop-filter: none; }",+ "}",+ ].join("\n");+ assert.deepStrictEqual(scanSource(quiet, "glass.css"), []);++ // Any spacing, and the -webkit- prefixed form, are left out too.+ const spaced = [+ ".a { backdrop-filter:none; }",+ ".b { backdrop-filter : none; }",+ ".c { -webkit-backdrop-filter: none; }",+ ".d { backdrop-filter: blur(8px); }",+ ].join("\n");+ assert.deepStrictEqual(scanSource(spaced, "glass.css"), []);++ // A "none" declaration in the other form must not hide a real blur (CodeRabbit review on #331).+ const noneThenPrefixed = [+ ".a { backdrop-filter: none; -webkit-backdrop-filter: blur(8px); }",+ ".b { backdrop-filter: none; -webkit-backdrop-filter: blur(8px); }",+ ".c { backdrop-filter: none; -webkit-backdrop-filter: blur(8px); }",+ ].join("\n");+ assert.deepStrictEqual(scanSource(noneThenPrefixed, "glass.css").map((f) => f.rule), ["glass-everywhere"]);+ const prefixedNoneThenBlur = [+ ".a { -webkit-backdrop-filter: none; backdrop-filter: blur(8px); }",+ ".b { -webkit-backdrop-filter: none; backdrop-filter: blur(8px); }",+ ".c { -webkit-backdrop-filter: none; backdrop-filter: blur(8px); }",+ ].join("\n");+ assert.deepStrictEqual(scanSource(prefixedNoneThenBlur, "glass.css").map((f) => f.rule), ["glass-everywhere"]);++ // Three real blur surfaces are still flagged, even with a `none` rule in the file.+ const flagged = [+ ".a { backdrop-filter: blur(12px); }",+ ".b { backdrop-filter: blur(16px); }",+ ".c { backdrop-filter: blur(20px); }",+ "@media print { .a { backdrop-filter: none; } }",+ ].join("\n");+ assert.deepStrictEqual(scanSource(flagged, "glass.css").map((f) => f.rule), ["glass-everywhere"]);+});+test("glass-everywhere counts backdropFilter in JS style objects", () => {// The repro from issue #288.const flagged = [