Repository navigation
feat(images): overhaul HTML and CSS image hiding (v2.31.0) - #204
Conversation
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: 3bf3d0e736
ℹ️ 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".
| } | ||
|
|
||
| function resolveHideImagesMode(value: unknown): HideImagesMode | null { | ||
| if (value === true || value === "all") return "all"; |
There was a problem hiding this comment.
Keep profile image preferences decorative-only
When AccessibilityPreferences.hideDecorativeImages is true, mapProfileSettingsToFeatures() in src/core/profiles.ts passes boolean true; this branch now interprets it as all, so applying or restoring that profile hides informative images too, unlike the preference’s decorative-only contract. Map the profile boolean to "decorative" so profiles retain their existing behavior.
Useful? React with 👍 / 👎.
| /(?:url|-webkit-image-set|image-set|cross-fade)\s*\(/i; | ||
| const HIDE_IMAGES_STYLE_ID = "arap-hide-images-style"; | ||
| const HIDE_IMAGES_PSEUDO_CSS = [ | ||
| "[data-arap-hide-before-bg]::before { background-image: none !important; }", |
There was a problem hiding this comment.
Override high-specificity host pseudo-image rules
If a host rule such as #hero::before { background-image: url(... ) !important; } applies, its ID selector has higher specificity than this injected attribute selector; since both declarations are !important, the host image remains visible even after the scanner marks the element. Use an override that wins against high-specificity host rules.
Useful? React with 👍 / 👎.
Summary
HideImagesController(mode="all") + dedicatedHideDecorativeImagesController(mode="decorative"):HideImagesControllernow hides all non-protected host<img>(including non-emptyaltand missingalt),<picture>,<object type="image/*">,<embed type="image/*">, and explicitly decorative<svg>elements, whileHideDecorativeImagesControllerand<HideImagesController mode="decorative" />retain strict decorative-only behavior.HIDE_IMAGES_MODES,HideImagesMode, andHideImagesValuefromsrc/index.ts, and updatedbuiltins.hideImagesvalidation insrc/core/featureSchema.ts.src/core/effects.ts):background-image,backgroundshorthand, CSS variables (var(...)),image-set()/-webkit-image-set()/cross-fade(),list-style-image, elementcontent: url(...),html/bodyhost roots, and::before/::afterpseudo-elements (via CSP-nonce-aware#arap-hide-images-style, openShadowRootstyles, anddocument.styleSheetsrule scanning), while preserving pure CSS gradients.aria-labelsections, landmarkroles, and ordinary class names like.paragraph,.typography,.photography,.roadmap,.sitemap,.charter,.aftermath, and.faqRoware no longer skipped, while widget UI,[data-arap-ignore]/[data-arap-exempt], interactive buttons/controls, icon-only links, CAPTCHAs, charts, maps, QR/barcodes, and math stay protected.applyMediaIncremental()+observer.takeRecords()+style/class/src/altdynamic mutation handling and memoized{ effectScope, nonce }options inAccessibilityPlugin.2.31.0:docs/DECORATIVE_IMAGES.md,docs/FEATURES.md,docs/API.md,docs/SCOPED_EFFECTS.md,docs/MIGRATION.md,docs/PROJECT_STATUS.md,examples/basic-usage/main.tsx,CHANGELOG.md,package.json, andpackage-lock.json.Verification
npm run format:check: passednpm run validate(typecheck,eslint --max-warnings 0,vitest run51 files / 526 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, andmobilegit diff --check: passed