Skip to content

fix(images): address PR review feedback for profiles, pseudo specificity, and large subtrees - #206

Merged
prabothcharith merged 1 commit into
developmentfrom
fix/hide-images-review-feedback
Nov 20, 2026
Merged

prabothcharith merged 1 commit into
developmentfrom
fix/hide-images-review-feedback

Conversation

@prabothcharith

Copy link
Copy Markdown
Owner

Summary

Addresses the review findings from #204 / #205:

  • Preserve decorative-only mode for profiles and presets (src/core/profiles.ts): mapProfileSettingsToFeatures() now maps hideDecorativeImages: true to hideImages: "decorative" (instead of true / "all"), keeping AccessibilityPreferences.hideDecorativeImages strictly decorative-only across profiles and custom preset round-trips.
  • Boost pseudo-element CSS override specificity (src/core/effects.ts): #arap-hide-images-style selectors use chained :not(#id) specificity boosters (3, 1, 1) so pseudo-element background-image: none !important and visibility: hidden !important beat high-specificity host !important ID rules (e.g. #hero::before { background-image: url(...) !important; }).
  • Handle oversized (>200-node) subtrees on dynamic class mutations (src/core/effects.ts): Added a 50ms debounced flushLargeClassSubtrees path bounded by MAX_HOST_ELEMENTS so dynamic class toggles on containers with more than 200 descendants still reprocess affected descendant CSS/pseudo images.
  • Regression tests: Added unit tests for profile/preset round-trip decorative mode and >200-node dynamic class mutations in tests/decorativeImages.test.tsx, plus a real-browser ID-selector !important pseudo-element test in tests/browser/widget.spec.ts.

Verification

  • npm run format:check & git diff --check: passed
  • npm run validate (typecheck, eslint --max-warnings 0, vitest run 51 files / 528 tests, tsup + CSS build): passed
  • npm run pack:check & npm run test:consumers (React 18 Vite, React 19 Tailwind Vite, Next.js 16, ESM+SSR, CJS, strict NodeNext declarations): passed
  • npm run test:browser: 260 passed, 10 intentional Next-only skips, 0 failures across react18-chromium, react19-tailwind, next-app, firefox, webkit, and mobile

Copilot AI balanced review requested due to automatic review settings November 20, 2026 06:40

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-20T06:43:55.036856Z 102dacc PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread src/core/effects.ts
"[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; }",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Comment thread src/core/effects.ts
Comment on lines +2609 to +2610
for (const desc of Array.from(root.querySelectorAll("*"))) {
if (collected.length >= MAX_HOST_ELEMENTS) break;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

@prabothcharith
prabothcharith merged commit 0991482 into development Nov 20, 2026
4 checks passed
@prabothcharith
prabothcharith deleted the fix/hide-images-review-feedback branch November 20, 2026 06:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants