Opened 15 months ago
Closed 2 months ago
#62696 closed defect (bug) (fixed)
Type for `multiple` attribute in `CollectionAdd` and `GalleryAdd` controllers is incorrect
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 7.0 | Priority: | normal |
| Severity: | normal | Version: | |
| Component: | Media | Keywords: | has-patch |
| Focuses: | docs | Cc: |
Description
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 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
Change History (3)
This ticket was mentioned in PR #8012 on WordPress/wordpress-develop by @yogeshbhutkar.
15 months ago
#1
- Keywords has-patch added
## Description
Updated the JSDoc documentation for the
multipleattribute inGalleryAddandCollectionAddmedia controllers to accurately reflect its behavior with different values.### Context
The
multipleattribute accepts both boolean and string values, with different behaviors:multiple=true: Requires SHIFT/CMD/CTRL key to select multiple itemsmultiple='add': Allows selecting multiple items by clicking thumbnails directly### Technical Changes
{boolean|string}in both controllerstrueand'add'values'add'had no special behavior### Files Changed
src/js/media/controllers/gallery-add.jssrc/js/media/controllers/collection-add.jsTrac ticket: https://core.trac.wordpress.org/ticket/62696