Carousel block: derive slide-dependent values and move source replay out of attributes
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 15/100
- Issue type
- Refactor
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- javascript, php, wordpress
- Domain
- tooling
Research direction
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.
Written by the indexing model from the issue text.
Description
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.
- Dominant language
- PHP
- Stars
- 22
- Forks
- 2
- Avg merge
- 8h 22m
- Merged PRs (30d)
- 659
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
-
Solved site promotion gate fails on runner PHP patch drift (expects 8.2.33, runner installs 8.2.34)Open
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Automattic/blocks-engine#2161 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Automattic/blocks-engine#2061 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Automattic/blocks-engine#1701 ·
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
-
Product-grid detection: facet-drawer heading becomes a product, names absorb whole card text, slugs drop accentsPossibly taken @chubes4 claimed this today. Open
Difficulty 4/5 3-5 days Newbie friendliness 35/100
Automattic/blocks-engine#3185 ·
Maintainers usually reply within 1 day
All issues in Automattic/blocks-engine
Similar issues
-
Awaiting Triage enhancement / feature request
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
macOS
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
beyondcode/herd-community#1774 ·
-
Successful AUTHORISATION for a transaction already set to "failed" is marked done without paying itOpen
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Adyen/adyen-shopware6#895 ·
Maintainers usually reply within 1 day
-
not confirmed
Difficulty 2/5 1-3 hours Newbie friendliness 63/100
Maintainers usually reply within 1 day