fix(php-transformer): keep visually hidden class rules on preserved markup - #2242
Merged
Merged
Conversation
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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,
cliporclip-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.phpUnfixed (
git stashof the projector):Fixed:
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-engineb3c4a143f). Playwright at 1440px, label whose text isPrice, next to the visible amount: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).