Repository navigation
fix(images): address PR review feedback for profiles, pseudo specificity, and large subtrees - #206
Conversation
…ity, and large subtrees
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 102dacc5a5
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| "[data-arap-hide-after-bg]::after { background-image: none !important; }", | ||
| "[data-arap-hide-before-content]::before { visibility: hidden !important; }", | ||
| "[data-arap-hide-after-content]::after { visibility: hidden !important; }", | ||
| "[data-arap-hide-before-bg]:not(#arap-s1):not(#arap-s2):not(#arap-s3)::before { background-image: none !important; }", |
There was a problem hiding this comment.
Keep the specificity hack from excluding real host IDs
When a host element with a pseudo image has the ID arap-s1, arap-s2, or arap-s3, each :not() term excludes it, so the hide rule does not match even though the plugin marked the pseudo for hiding. Use a specificity bump that cannot exclude an element with one of these IDs.
Useful? React with 👍 / 👎.
| for (const desc of Array.from(root.querySelectorAll("*"))) { | ||
| if (collected.length >= MAX_HOST_ELEMENTS) break; |
There was a problem hiding this comment.
Bound descendant traversal before materializing the subtree
When a class change occurs on a subtree with more than 200 descendants, Array.from(root.querySelectorAll("*")) materializes every descendant before the loop can enforce MAX_HOST_ELEMENTS; the observer has already queried this subtree to detect that it is large. On very large dynamic pages, this adds work and memory proportional to the entire subtree and can stall the main thread despite the cap. Use a traversal that stops once the limit is reached.
Useful? React with 👍 / 👎.
Summary
Addresses the review findings from #204 / #205:
src/core/profiles.ts):mapProfileSettingsToFeatures()now mapshideDecorativeImages: truetohideImages: "decorative"(instead oftrue/"all"), keepingAccessibilityPreferences.hideDecorativeImagesstrictly decorative-only across profiles and custom preset round-trips.src/core/effects.ts):#arap-hide-images-styleselectors use chained:not(#id)specificity boosters(3, 1, 1)so pseudo-elementbackground-image: none !importantandvisibility: hidden !importantbeat high-specificity host!importantID rules (e.g.#hero::before { background-image: url(...) !important; }).classmutations (src/core/effects.ts): Added a 50ms debouncedflushLargeClassSubtreespath bounded byMAX_HOST_ELEMENTSso dynamic class toggles on containers with more than 200 descendants still reprocess affected descendant CSS/pseudo images.tests/decorativeImages.test.tsx, plus a real-browser ID-selector!importantpseudo-element test intests/browser/widget.spec.ts.Verification
npm run format:check&git diff --check: passednpm run validate(typecheck,eslint --max-warnings 0,vitest run51 files / 528 tests,tsup+ CSS build): passednpm run pack:check&npm run test:consumers(React 18 Vite, React 19 Tailwind Vite, Next.js 16, ESM+SSR, CJS, strict NodeNext declarations): passednpm run test:browser: 260 passed, 10 intentional Next-only skips, 0 failures acrossreact18-chromium,react19-tailwind,next-app,firefox,webkit, andmobile