[wp-trac] [WordPress Trac] #62696: Type for `multiple` attribute in `CollectionAdd` and `GalleryAdd` controllers is incorrect

WordPress Trac noreply at wordpress.org
Mon Dec 16 14:53:16 UTC 2024


#62696: Type for `multiple` attribute in `CollectionAdd` and `GalleryAdd`
controllers is incorrect
--------------------------+-----------------------------
 Reporter:  mikachan      |      Owner:  (none)
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Media         |    Version:
 Severity:  normal        |   Keywords:
  Focuses:  docs          |
--------------------------+-----------------------------
 The specified type for `multiple` in the `CollectionAdd` and `GalleryAdd`
 media controllers seems incorrect. It's documented as a boolean, but the
 actual functionality allows for either a boolean or 'add' as a string.

 The attribute has the following todo note next to it:

 > @todo 'add' doesn't seem do anything special, and gets used as a
 boolean.

 However, 'add' does change the behaviour slightly, as described in
 [https://github.com/WordPress/gutenberg/issues/9137 this Gutenberg issue]:

 – `multiple = true`: makes it possible to select multiple items in the
 Media library but, by default, clicking on the thumbnail of an item
 automatically deselect the previously selected item. In order to select
 multiple items, it is necessary to click with SHIFT or CMD/CTRL

 – `multiple = 'add'`: makes it possible to select multiple items in the
 Media library and items keep being added simply clicking on their
 thumbnails, without any need to use the SHIFT or the CMD/CTRL key. In
 order to deselect a selected item, one can simply click on its
 correspondent check mark.

 I believe these controllers' docs should be updated to allow this
 attribute to be a boolean or a string. There are two files where the
 update is required:

 - src/js/media/controllers/collection-add.js
 - src/js/media/controllers/gallery-add.js

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/62696>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list