Conversation
|
Size Change: 0 B Total Size: 7.66 MB ℹ️ View Unchanged
|
9c6faa6 to
669168f
Compare
|
Flaky tests detected in 7c2cdf2. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/23353425675
|
e810594 to
80739c1
Compare
Made-with: Cursor
80739c1 to
7c2cdf2
Compare
Add Dialog.Description, remove Drawer.Footer, add size support to Drawer, forward additional Base UI props, and make content layout unopinionated. Made-with: Cursor
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.
Closes #75291
What?
Add a
Drawerprimitive to@wordpress/ui, wrapping Base UI's Drawer with WPDS styling and the same compound-component patterns used by Dialog.Details
The Drawer component provides a panel that slides in from any viewport edge with swipe-to-dismiss gestures. It mirrors the Dialog API shape (
Root,Trigger,Popup,Header,Title,Description,CloseIcon,Action) and adds drawer-specific capabilities likeswipeDirectionand thesizeprop that operates on the relevant axis (width for left/right, height for up/down).This PR also adds a
Dialog.Descriptionsubcomponent and forwards additional Base UI props (initialFocus,finalFocus,disablePointerDismissal,onOpenChangeComplete) to both Dialog and Drawer.Why?
Gutenberg needs a standard drawer/panel primitive for side panels, bottom sheets, and mobile navigation. Wrapping Base UI gives us accessible, gesture-aware behavior out of the box.
Details
Several places in the editor use custom panel implementations. A shared Drawer primitive provides consistent animation, accessibility (focus trapping, ARIA labelling via Title), and swipe gestures without reinventing them per feature.
How?
Compound-component architecture matching Dialog:
Rootmanages state,Popuphandles portal/backdrop/viewport,Titleregisters for validation, and a CSS variable system (--popup-size,--stretch-size,--viewport-inset) drives the size presets across all four directions.Details
Root,Trigger,Popup,Header,Title,Description,CloseIcon,Action.Drawer.Footerremoved — layout is left to consumers (e.g. viaStack).Dialog.Descriptionadded — mirrors the existingDrawer.Descriptionpattern.sizeprop onDrawer.Popup—small | medium | large | stretch. Applies to width (left/right) or height (up/down). When omitted, left/right default to a medium width token; up/down fit their content.--viewport-insetensures a minimum gap from the opposite edge (same token as Dialog).initialFocus,finalFocus,disablePointerDismissal,onOpenChangeCompleteon both Dialog and Drawer.Stackto demonstrate spacing.Drawer.Titleis missing or empty (tree-shaken in production).Testing Instructions
npm run storybook:dev.Dialog.Descriptionin subcomponents.Testing Instructions for Keyboard
TODO
Drawer.Action? Or is a plainButtonsufficient?Descriptionsubcomponent — is it needed for both Dialog and Drawer, or only one of them?swipeDirection)Stack?--viewport-inset, size classes, subcomponent CSS like Header/Description/Footer)Use of AI Tools
This PR was authored with assistance from an AI coding agent (Claude) in Cursor, used for code generation, refactoring, and PR description drafting. All changes were reviewed by the author.