"Select all media" checkbox disappears after using paginator in Media Library Grid view

Created on 4 August 2021, almost 3 years ago
Updated 15 November 2023, 7 months ago

Problem/Motivation

The Select all media checkbox is only usable on the first page of results in the Media Library's Grid view.

Steps to reproduce

  1. Create a new standard Drupal site
  2. Enable the Media and Media Library modules
  3. Visit /admin/content/media
  4. Create pieces of media until a paginator appears in the Grid tab (currently, you must create at least 25 pieces of media)
  5. Navigate to the Grid tab
  6. Notice the Select all media checkbox
  7. Navigate to the second page of results
  8. Notice that the Select all media checkbox does not appear
  9. Navigate back to the first page of results
  10. Notice that the Select all media checkbox does not appear

Proposed resolution

I believe this happens because the context which is passed to the MediaLibrarySelectAll behavior after pagination has the .js-media-library-view[data-view-display-id="page"] element as its root element. As a result, the element cannot be selected using jQuery's $() selector, which is constrained to searching descendents of the root element of the context.

See lines 15-18 of .

If line 17 is removed, causing the $() selector to search the entire DOM rather than only the context, the Select all media checkbox does not disappear.

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

I noticed this happening on Drupal 9.2.3.

🐛 Bug report
Status

Needs work

Version

11.0 🔥

Component
Media 

Last updated about 9 hours ago

Created by

🇺🇸United States john.karahalis

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024