Summary
This ticket introduces multi-value support for Image and Video prop types in the Canvas component editor UI.
Unlike other prop types(#3576003: Add Multi-Value Integer & Number Prop Support (UI), #3573096: Add Multi-Value Text Prop Support (UI)), media items should be displayed directly in the list as thumbnails. Users will be able to reorder, remove, and add media items using inline controls without opening a separate editing panel.
Problem Statement
Currently, the Canvas prop configuration UI does not support managing multiple media items for Image and Video prop types in a user-friendly way.
For media props, users should be able to:
- View media items as thumbnails.
- Reorder media items using drag-and-drop.
- Remove media items directly from the list.
- Add additional media items using an add media control.
- See a clear indicator of how many media items are currently remaining to attach.
Scope
- UI only — This ticket focuses on front-end behavior.
- No backend schema or storage changes are included.
- Applies to both Image and Video prop types.
Proposed Behavior
1. Media Thumbnail List
Media items should be displayed directly in the UI as a list of thumbnails.
Each media item should include:
- A thumbnail preview of the image or video.
- A six-dot matrix drag handle to reorder items.
- A remove icon button to delete the media item.
No popup or side panel should be opened when interacting with the media items.
2. Drag and Drop Reordering
- Media items can be reordered using the six-dot drag handle.
- Dragging an item should allow users to move the item up or down in the list.
The underlying data model should update immediately after the reorder operation.
3. Removing Media
- Each media item includes a remove icon.
- Clicking the remove icon removes the media item immediately.
- No confirmation dialog should appear.
The UI and underlying data model should update instantly.
4. Media Count Indicator
Below the media list, a text indicator should display the number of currently remaining media items.
Example format:
- 2 media items renaming
This helps users understand how many media items are remain to attach.
5. Add Media Button
Below the counter text, display an Add Media button.
- Clicking this button opens the media selector.
- Users can select additional media items.
- The selected media should appear in the list as thumbnails.
If a maximum limit is configured:
- The Add Media button should not visible.
Acceptance Criteria
- Image and Video prop types support multiple media items.
- Media items render as thumbnails in a list.
- Users can reorder items via drag-and-drop using the six-dot handle.
- Users can remove media items using the remove icon.
- Removing media does not show a confirmation dialog.
- A counter text displays the number of media items renaming.
- An Add Media button allows users to attach additional media.
- The Add Media button becomes invisible when the configured limit is reached.
- The drag handle remains disabled when there is only one media item and becomes visible for subsequent media items when multiple items are present.

| Comment | File | Size | Author |
|---|---|---|---|
| #8 | vid.zip | 1.69 KB | vipin.mittal18 |
Issue fork canvas-3577219
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
vipin.mittal18Comment #4
vipin.mittal18Comment #6
vipin.mittal18Comment #7
narendrarComment #8
vipin.mittal18Unable to verify the video as described in the testing steps because enabling the canvas_test_article_fields module causes an error. Instead, I created the video SDC component, verified it, and attached the SDC component zip here.


Animated GIF of working functionality
Comment #9
bnjmnmWill have feedback in the MR shortly - but switching from RTBC to ensure it's not merged yet.
Comment #10
bnjmnmThe issue title and summary mention props multiple times, but the only tests in the MR work with the entity form, which does not deal with props at all. This should either update the issue summary to accurately scope what is being done (which seems to be reskinning the media library widget) or the tests need to be expanded to cover this UI change with components using a multi-media widget.
Comment #11
narendrarFeedback addressed.
Comment #12
bnjmnmThere are issues with this sort implementation:
Fortunately, as part of helping with a separate issue, I found a way to implement sorting that seems to work well - see this MR and resembles what's being done here, though you'll notice some differences.
Because it was part of a larger issue, not all of it is specific to the sorting, but you should be able to pick the bits you need which is basically every JS / JSX file added, along with the changes in
src/Hook/ReduxIntegratedFieldWidgetsHooks.phpIt might be necessary to coordinate a bit between the two MRs, but I think that will ultimately be more efficient than bringing in the approach in this issue then having to perform a more surgical change.
Comment #13
vipin.mittal18Thanks Ben for taking the time to review this and for pointing out the sorting concerns.
Just to add a bit of context from this ticket’s side — the scope here is mainly focused on the UI behavior, specifically showing the drag handle when the media field has multiple cardinality values (image/video). For single-value props, the handle is intentionally not visible.
I completely understand the sorting concerns you mentioned, and I believe those are being addressed in the sorting MR !725 you created.

I also did a quick verification with both MRs (MR !725 MR !689) together, and they seem to work well in combination. Refer screenshot
From this issue perspective, these UI changes are still needed so that the behavior between single-value and multi-value props is differentiated (showing the drag handle only when multiple values are allowed).
Comment #14
vipin.mittal18Marking this issue again RTBC as these changes are necessary from a UI perspective.
Comment #16
narendrarCreated a new MR https://git.drupalcode.org/issue/canvas-3577219/-/merge_requests/1 on top of https://git.drupalcode.org/project/canvas/-/merge_requests/725
as suggested by Ben.
Comment #17
wim leersI think this should get final sign-off from @bnjmnm prior to getting merged.
Comment #19
bnjmnmThe MR linked in comment #16 doesn't seem to have any of the solutions I provided, and also seems to be a request to merge into the 3546869-sort-integration of this issue's fork, not 1.x.
I created an MR from the 3577219-add-multi-value-imagevideo-v2 as that looks to have the solution I provided. I will provide some feedback on that branch. At the very least, there are a few things from my solution that need to be addressed. If that MR isn't what you intend to merge, the feedback will still be relevant.
I realize I made it a little tricky by introducing a big chunk of code in something I was otherwise reviewing - it would be good if someone else reviews my additions. Despite the hassle I think these additions will ultimately save us time and suffering, but it does make the process a little odd.
Comment #20
narendrarMy assumption was that we will do changes on top of https://git.drupalcode.org/project/canvas/-/merge_requests/725, so that once 725 is merged, only my changes remain.
Hence, https://git.drupalcode.org/issue/canvas-3577219/-/merge_requests/1 has additional changes on top of 725.
Comment #21
tim.plunkettComment #25
bnjmnmThe approach to sort in MR 689 shouldn't ever be something merged to 1.x, especially since I already have a solution that works. I went through the other parts of 698 such as drag handle functionality (and how it is disabled on single items) and added those to a branch with the sorting approach i came up with. Please see 3577219-media-with-sort. Will switch to NR once tests are green
Comment #26
bnjmnmThe only fail in CI is a PHPStan problem that was accidentally merged into 1.x
Comment #28
narendrarIn https://git.drupalcode.org/project/canvas/-/merge_requests/733/diffs?com..., added drag handle conditionally and removed some unnecessary css changes.
Tested manually and it is working as expected.
Comment #29
vipin.mittal18The functionality of the prop type for multiple cardinalities has been verified and is working as expected(attached gif). Marking this issue as RTBC and will merge once @bnjmnm final approval are in place.
Comment #30
vipin.mittal18Are the test failures because the media first item is disabled?
Comment #31
narendrarComment #33
tim.plunkettMerged, thanks!
Comment #35
wim leersIs it correct to conclude that technical debt has been paid down thanks to this code having been deleted? 😊
I don’t understand why this is no longer necessary. But it seems good to no longer have it 😄
Thanks for all the ℹ️ comments, Ben, that’s really helpful. Maybe just one more on that code block would be helpful for more people besides just me?
Sincerely, a React noob 🥸
Comment #37
bnjmnmAdded MR 755 to address a race condition with the media remove button. The store update should not happen until the core AJAX request is complete, which can happen now that the update is triggered by the actual click of the remove button, and not a side effect of the AJAX replace.
Not switching status until it's green... I'm not sure if the playwright fails are valid, but it's not generating the artifacts that would help me determine that.
Comment #38
bnjmnmComment #40
bnjmnm