Draft
Conversation
|
Size Change: +5.89 kB (+0.19%) Total Size: 3.1 MB
ℹ️ View Unchanged
|
Contributor
|
Hi I did not fully understand why the slider-track could not be part of the slider block. Why does it need to be a separate block? |
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.
Dedicated Slider Block - POC
POC of a dedicated Slider block to explore the approach of creating purpose-built Slider.
Approach
A set of new core blocks following Gutenberg patterns, designed as a generic container that can hold any content (images, text, custom blocks) as slides.
Structure:
What's Implemented
Blocks Created
core/slider- Main container, provides context, holds interactive statecore/slider-track- Scrollable flex container with CSS scroll-snapcore/slide- Individual slide wrapper, accepts any inner blockscore/slider-controls- Navigation usingcore/buttonswithcore/buttoninsideTechnical Implementation
view.js) for client-side state management (currentIndex,totalSlides)scroll-snap-type: x mandatory,scroll-behavior: smooth) for native scrollingrender_callback) for injecting directivesWP_HTML_Tag_Processorto add directives tocore/buttonblocks dynamicallywp-on--scrolldirectivearia-roledescription="carousel", dynamicaria-label)"listView": true) for managing slides in inspectorWhat Works
core/buttons+core/buttonfor controls (Gutenberg-native)dimensions.heightandaspectRatioon slider-trackProblems & Limitations
1. Control Positioning / Overlay Layout
position: absolutebut then there's no editor parity - editor shows normal flow, frontend uses absolute positioning2. Query/Dynamic Content
Architectural Questions
How to solve overlay positioning in Gutenberg-native way?
Should slider be a block or a layout behavior or both?
How to handle editor preview for interactive behaviors?
Conclusion
This POC demonstrates that a dedicated Slider block is technically feasible using Interactivity API + CSS Scroll Snap. However, significant gaps remain:
Screenshots or screencast
Screen.Capture.on.2026-01-22.at.21-32-01.mp4