Carousel block: derive slide-dependent values and move source replay out of attributes
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 15/100
- Tipo di issue
- Refactoring
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- javascript, php, wordpress
- Ambito
- tooling
Direzione di ricerca
Start with the attribute definitions in AuthoredCarouselBlockGenerator, then trace the editor, save and view script that read them, plus safeControlTopologyMarkup in PHP. Build the attribute inventory the acceptance list asks for, classifying each of the 46 attributes as editor-facing, derived or fidelity carry. Done means that inventory exists and the fixtures/websites/ carousel imports still hold parity, with any regression listed. The design choices (native supports, structural controls) need maintainer agreement before code changes.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Summary
The generated carousel block (AuthoredCarouselBlockGenerator) declares 46 attributes. Only a handful describe the carousel a user would edit. Most of the rest replay the source page's markup and geometry, and two of them hold raw HTML. As a result, the block is hard to edit, and editing it can leave the saved markup out of step with its slides.
This issue proposes auditing the attributes against what an editor needs, and moving source fidelity out of block attributes.
Related: #220 (rebuild interactive behaviors with WordPress-native primitives).
What the attributes are today
Carousel settings a user would recognize. The block's sidebar exposes only the five marked with *:
transitionStyle*,transitionDuration*,autoplayInterval*,showPlayControl*,playControlPosition*wrap,itemsPerView,initialSlide,showDots,showStatusthumbnailPosition,fullBleed,ariaLabel
Source replay, which nobody can see or edit in the editor:
sourceRootGeometry,sourceCustomProperties,sourceIdentityAttributessourcePresentationClasses,sourceControlClasses,sourceControlAttributesstageWrappers,stageTrackClassName,stageMinHeight,stageAspectRatio,stageMaxWidth,viewportHeightcontrolPresentation,previousControlPresentation,nextControlPresentationpreviousControlClasses,nextControlClasses,previousControlVisual,nextControlVisualsourceControlArtwork,playControlInset
Raw HTML stored in attributes:
sourceControlTopologyis injected withdangerouslySetInnerHTMLinsaveand passed throughsafeControlTopologyMarkupin PHP.srcSwapMarkupis split on a sentinel comment and written into the slide sequence.
Values derived from content but stored separately:
slideCountdetermines how many dotssaverenders.thumbnailsstores a URL list thatsaverenders as the thumbnail rail.
Problems
- Saved markup drifts out of step with the slides. The editor lets users add or remove slides (
InnerBlockswith an appender), butslideCountandthumbnailsdon't follow:- The saved dots and thumbnails keep the count and images from import time.
- The view script counts the slides from the DOM, so the controls and the slides can disagree.
- Editing is mostly invisible. Only 5 of 46 attributes are shown in the sidebar. Geometry, control artwork and wrappers can only be changed by hand-editing the block comment.
- Raw HTML in attributes. Control markup and slide sequences stored as HTML strings get none of the block editor's editing, validation or sanitizing. They also tie the block to the source page's DOM.
- Per-site generated code. Every import ships its own copy of this block under the site's namespace. The more source detail the attributes carry, the more each site's content depends on that generated copy.
Proposal
- Derive values from the content.
- Count the dots from the inner blocks at save time, or render them in the view script.
- Read the thumbnails from the slides' images.
- Remove
slideCountandthumbnails.
- Use native block supports for presentation. Map geometry and spacing to the block's
styleattribute (dimensions, spacing, color, border) so it is editable like any other block. Move the source-specific classes and custom properties toclassNameand theme or global styles, which is where the rest of an imported site's styles already live. - Make controls structural. Replace
sourceControlTopologyandsrcSwapMarkupwith:- a small, enumerated set of control layouts (attributes such as dot or arrow placement), or
- inner blocks for the controls,
so that no HTML is stored in attributes.
- Expose what remains. Every attribute left after the audit should either appear in the sidebar or be derived. Document anything that can't be either as an intentional fidelity carry.
Acceptance
- An attribute inventory classifies each attribute as editor-facing, derived or fidelity carry, with the reason for each.
- After adding or removing a slide in the editor and saving, the dots, thumbnails and slides agree on the front end, and the block validates on reload.
- No attribute holds HTML.
- The carousel fixtures in
fixtures/websites/still import at their current parity. Any regression is listed, with its cause.
Drafted with AI assistance (Claude, running in the Pi coding agent). The agent read the carousel generator's attribute definitions, editor, save and view script on trunk, and counted the exposed controls. The author reviewed it before posting.
- Lingua principale
- PHP
- Stelle
- 22
- Fork
- 2
- Merge medio
- 8h 12m
- PR unite (30g)
- 679
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
-
Solved site promotion gate fails on runner PHP patch drift (expects 8.2.33, runner installs 8.2.34)Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
Automattic/blocks-engine#2161 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
Automattic/blocks-engine#2061 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
Automattic/blocks-engine#1701 ·
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
-
Form presentation graph: record a visual part's side relative to the labelForse già presa @chubes4 l’ha presa oggi. Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
Automattic/blocks-engine#3251 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di Automattic/blocks-engine
Issue simili
-
0.kind: enhancement 9.needs: package (update)
Difficoltà 2/5 1-3 ore Idoneità per principianti 67/100
NixOS/nixpkgs#577156 · 3 reazioni ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
MagnaCapax/PMSS#1142 · 1 commento ·
I maintainer di solito rispondono entro 3 giorni
-
Native-arrow select renders a second Jetpack chevronForse di nuovo libera Una pull request per questa issue è stata chiusa senza essere unita. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
Automattic/static-site-importer#2294 ·
I maintainer di solito rispondono entro 1 giorno
-
bug 🐛
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
netalertx/NetAlertX#1856 · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
Bug Status: Needs Triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno