Skip to content

fix(php-transformer): keep visually hidden class rules on preserved markup - #2242

Merged
chubes4 merged 1 commit into
trunkfrom
fix/visually-hidden-text
Sep 26, 2026
Merged

chubes4 merged 1 commit into
trunkfrom
fix/visually-hidden-text

Conversation

@chubes4

@chubes4 chubes4 commented Sep 26, 2026

Copy link
Copy Markdown
Contributor

Problem

Visually hidden screen-reader text paints after import. A product card shows the label and the amount together where the source shows only the amount. The label stays in the DOM, but the clip/1px rule that hid it does not apply.

Root cause

Author stylesheet projection rewrites a class rule onto a semantic marker or an inline-layout carrier and drops the authored selector. That is correct when conversion emits the marker or carrier. Preserved markup (a repeated collection, extracted chrome) keeps the class and does not emit the marker, so the hiding declarations never match. The label renders as normal text.

Fix

When a rule's declarations are the visually-hidden clip pattern (absolute 1px box, overflow hidden, clip or clip-path), keep the authored class selector alongside the projected form. The class still hides the text wherever the markup lands. Tag-only selectors are not carried.

Regression test

php tests/unit/visually-hidden-authored-clip.php

Unfixed (git stash of the projector):

FAIL: a clip/1px class inside a preserved link stays visually hidden
FAIL: a carrier-projected clip class still hides the preserved label
FAIL: a clip-path inset pattern is the same visually-hidden class rule
visually hidden authored clip FAILED: 5 passed, 3 failed

Fixed:

visually hidden authored clip passed: 8 assertions

Also passed: visually-hidden-menu-toggle-label.php, dead-projected-selectors.php, css-value-inspector.php, author-selector-semantics.php, artifact-author-stylesheet-projection.php.

Verification

Fresh import of the captured shop route with this commit vendored into Static Site Importer (blocks-engine b3c4a143f). Playwright at 1440px, label whose text is Price, next to the visible amount:

box (w×h) position clip visible
loop-2 baseline 32.8×22.5 static auto yes
this import 1×1 absolute rect(0px, 0px, 0px, 0px) no
source capture 1×1 absolute rect(0px, 0px, 0px, 0px) no

The amount stayed visible at 42.9×22.5 on both imports. The label text remained in the DOM. Verification site was stopped and deleted.

Fixes #2239

AI disclosure: implemented by xAI Grok 4.7 via OpenCode (opencode run), orchestrated and reviewed by Claude (Anthropic).

…arkup

Author projection rewrites a clip/1px class onto a marker or layout carrier and drops the authored selector. Preserved markup keeps the class, so the label paints. Carry that selector when the declarations are the visually-hidden pattern.
@chubes4
chubes4 marked this pull request as ready for review September 26, 2026 01:02
@chubes4
chubes4 merged commit fa345ba into trunk Sep 26, 2026
10 checks passed
@chubes4
chubes4 deleted the fix/visually-hidden-text branch September 26, 2026 01:02
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.

Visually hidden screen-reader text becomes visible after import

1 participant