Closed-state normalizer strips opacity:0 from text without a reveal gate, exposing hover/active-only state labels
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 58/100
Research direction
Start with ClosedStateNormalizer.php and StyleResolver.php, especially strip(), repairFor() and sourceRevealProperties(); then inspect the existing regression tests for closed-state normalization. Use the reduced HTML fixture with studio create --from <fixture>.html and check the imported label’s computed opacity in Playwright. Done means the import preserves opacity 0 when its reveal is CSS-only, with a regression fixture covering the case.
Written by the indexing model from the issue text.
Description
Summary
ClosedStateNormalizer removes opacity:0 from any text-bearing element, whether or not the source has a way to reveal it. The import then adds opacity:1!important;transform:none!important. A state label that the source hides at rest becomes permanently visible. Common examples are a playlist thumbnail's "Now Playing" overlay, which shows only on :hover or on the active item.
display:none, visibility:hidden and height/max-height:0 collapses are only stripped when sourceRevealProperties() finds a matching reveal rule or an aria-controls target. opacity:0 has no such gate.
This is related to #5198, but it is not the same case. The fixes for #5198 (#5228, #5264) exempt media-player control chrome (a role="group" "video controls" region with a seek range and play/mute buttons). The label here is ordinary text with no player controls around it, so that exemption does not apply.
Reduced fixture
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Playlist</title>
<style>
.label{opacity:0}
.item:hover .label{opacity:1}
</style>
</head>
<body>
<div class="item"><p>First video</p><div class="label">Current item</div></div>
</body>
</html>
To reproduce, run studio create --from <fixture>.html and open the front page.
Observed
Playwright computed style for the Current item text at 1440px:
| element | opacity |
|
|---|---|---|
| source fixture (file://) | div.label |
0 |
| imported WordPress page | p.label |
1 |
The emitted theme CSS (engine-support-after-author-*.css and editor-static-state-*.css) contains:
:root .label{opacity:1!important;transform:none!important}
- Dropping the
.item:hover .label{opacity:1}rule changes nothing: the output is identical. The hover rule is kept in the fixture only because it shows the label is meant to stay hidden at rest. Its reveal is plain CSS, which survives import unchanged and would still work in WordPress if the baseopacity:0were kept. - On the real-world page this came from (a site-builder video gallery), every thumbnail showed a centered "Now Playing" label. In the source, that label is
aria-hidden="true"and is revealed only by.item.is-active .label, .item.is-active:hover .label {opacity:1}. Both the live page and the capture computedopacity:0. The import forcedopacity:1. So the capture is correct and the problem happens during materialization.
Root cause
ClosedStateNormalizer::strip()stripsopacity:0unconditionally. It ignores$revealProperties, which gatesdisplay,visibilityand the height collapses: https://github.com/Automattic/blocks-engine/blob/ad346db3e39ca6bc261bc5baf373cae1f10562f8/php-transformer/src/HtmlToBlocks/Style/ClosedStateNormalizer.php#L36-L40repairFor('opacity:0')then emitsopacity:1!important;transform:none!important: https://github.com/Automattic/blocks-engine/blob/ad346db3e39ca6bc261bc5baf373cae1f10562f8/php-transformer/src/HtmlToBlocks/Style/ClosedStateNormalizer.php#L258StyleResolver::sourceRevealProperties()only ever reportsdisplay,visibility,height,max-heightandoverflow. It never reportsopacity: https://github.com/Automattic/blocks-engine/blob/ad346db3e39ca6bc261bc5baf373cae1f10562f8/php-transformer/src/HtmlToBlocks/Style/StyleResolver.php#L4543isDecorativeHiddenElement()returnsfalseas soon as the element has text, so a text-only state label always counts as frozen content.
Expected
opacity:0on content is kept, just likedisplay:noneorvisibility:hidden, unless the reveal really depends on script that the import removes. If the only reveal is a CSS pseudo-class such as:hoveror:focus-within, the closed state should be kept, because that reveal still works after import.aria-hidden="true"text should also be a strong signal that the element is a decorative state indicator, not editorial content.- A regression fixture built from the reduced case should fail on trunk and pass with the fix:
.labelcomputesopacity:0on the imported page.
Seen with Static Site Importer 1.34.104 and blocks-engine trunk ad346db3e39.
Reduced and filed with AI assistance (Claude, via coding agent).
- Dominant language
- PHP
- Stars
- 28
- Forks
- 5
- Avg merge
- 2h 59m
- Merged PRs (30d)
- 942
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Automattic/blocks-engine
-
Difficulty 2/5 1-3 hours Newbie friendliness 79/100
Automattic/blocks-engine#6318 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
Automattic/blocks-engine#4943 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
Automattic/blocks-engine#4942 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Automattic/blocks-engine#4921 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Automattic/blocks-engine#775 ·
Maintainers usually reply within 1 day
All issues in Automattic/blocks-engine
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
TYPO3-Solr/ext-solr#4850 ·
Maintainers usually reply within 2 days
-
[Sync EN] stream: document the errors of the stream_context_*() and stream filter functions (#6091)Opensync-en
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
[Sync EN] stream: document the errors of the stream_context_*() and stream filter functions (#6091)Opensync-en
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
Maintainers usually reply within 1 day
-
Перевод устарел
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
glpi-project/glpi#26353 · 2 comments ·
Maintainers usually reply within 1 day