feat(content-gates): add priority management UI#4518
feat(content-gates): add priority management UI#4518dkoo merged 29 commits intofeat/access-control-ui-gatesfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR implements a priority management UI for content gates, building on PR #4512. It adds functionality for users to reorder content gates via drag-and-drop or arrow buttons, ensuring that gates are checked in the correct priority order when determining which gate applies to content.
Changes:
- Added
isMediumprop to Modal component for a 512px width option - Created CardSortableList component - a reusable draggable/sortable list using WordPress Core's Card and Draggable components with smooth animations
- Implemented ContentGatesPriority modal for managing gate priority order with save/cancel functionality
- Enhanced Card component with draggable controls including drag handle and up/down arrow buttons
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
| src/wizards/audience/views/content-gates/content-gates.tsx | Replaced placeholder modal with ContentGatesPriority component, removed unused imports |
| src/wizards/audience/views/content-gates/content-gates-priority.tsx | New component implementing priority management UI with drag-and-drop and API integration |
| packages/components/src/modal/index.js | Added isMedium prop support for 512px modal width |
| packages/components/src/modal/style.scss | Added CSS for medium-width modal styling |
| packages/components/src/index.js | Exported new CardSortableList component |
| packages/components/src/card-sortable-list/index.tsx | New reusable sortable list component with FLIP animations for smooth reordering |
| packages/components/src/card-sortable-list/style.scss | Styles for sortable list animations and drag states |
| packages/components/src/card/core-card.js | Added draggable controls (drag handle and arrow buttons) to Card header |
| packages/components/src/card/style-core.scss | Added styles for draggable card controls and positioning |
| packages/components/src/card/index.js | Added draggable-related default props to Card component |
| packages/components/src/card-settings-group/index.tsx | Fixed component description comment (minor documentation update) |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…y.tsx Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…y.tsx Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…y.tsx Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…y.tsx Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Screenshot.2026-02-26.at.14.05.00.mp4There's something weird happening with the keyboard focus on the movers. The focus stays on the "card level" that I want to move and not on the individual card I selected. So in the video recording above, my focus is on "Gate w/ metering" to move up. After I press enter, I'd expect to still be on "Gate w/ metering" to move up (unless it's disabled because I'm at the top in which case the focus should to move down). But instead, the focus goes to "Gate" to move up. So I end up it a loop |
Looks like it's called |
|
@thomasguillot thanks for the feedback!
7ecdca9 fixes this.
The loader bar is the standard animation for Wizard components when an async operation is in progress—I think we should keep this consistent with the other wizard pages if possible. ef38e34 adds a
Added in 749d7e5. |
|
Brilliant, thank you @dkoo.
👍 |
…table list Add `id` field to `DraggableItem` type and use it as the React key instead of array index, preventing element mismatches on reorder. Also add a document-level dragover listener during drag to suppress the browser's snap-back animation when dropping outside the list container.
miguelpeixe
left a comment
There was a problem hiding this comment.
Tested well, except when dragging an item outside the list area, it hangs for a bit before dropping in position:
Gravacao.de.Tela.2026-02-26.as.17.12.41.mov
I decided to ask Claude, and it provided the solution, which I pushed to #4523. When the cursor is released outside any element with preventDefault() on its dragover, the browser doesn't recognize a valid drop target, so it animates the drag ghost back to its origin before firing dragend. The fix is to add a document-level dragover listener during the drag to suppress that behavior.
While at it, it also suggested using a stable key instead of the index for the sortable list item. I think it's a valid change.
Fix/sortable list improvements
|
@miguelpeixe Claude's suggestions improved upon Claude's solution, love it. I merged #4523 and the feature is much smoother/more responsive feeling now. |


All Submissions:
Changes proposed in this Pull Request:
Building on #4512, implements the new i3 designs for managing gate priorities.
isMediumprop to ourModalcomponent to support an in-between width of 512pxCardSortableListcomponent which uses the core-basedCardcomponent to create a draggable/sortable list of items. The items in the list move with animations, making it easier to see how the list will be reordered after dragging and dropping. This is intended to be an improvement on and eventual replacement for the existingdraggablevariation ofActionCard.How to test the changes in this Pull Request:
Draggablecomponent that our wrapper component uses, and is currently unavoidable.Other information: