Closed-state normalizer strips opacity:0 from text without a reveal gate, exposing hover/active-only state labels
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 58/100
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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).
- Lingua principale
- PHP
- Stelle
- 28
- Fork
- 5
- Merge medio
- 2h 59m
- PR unite (30g)
- 942
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di Automattic/blocks-engine
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 79/100
Automattic/blocks-engine#6318 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
Automattic/blocks-engine#4943 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
Automattic/blocks-engine#4942 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
Automattic/blocks-engine#4921 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
Automattic/blocks-engine#775 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di Automattic/blocks-engine
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
TYPO3-Solr/ext-solr#4850 ·
I maintainer di solito rispondono entro 2 giorni
-
[Sync EN] stream: document the errors of the stream_context_*() and stream filter functions (#6091)Apertasync-en
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
[Sync EN] stream: document the errors of the stream_context_*() and stream filter functions (#6091)Apertasync-en
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
I maintainer di solito rispondono entro 1 giorno
-
Перевод устарел
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
glpi-project/glpi#26353 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno