VBO breaks Media Library (Modal) item selection, if used on the media_library view

Created on 13 September 2023, over 1 year ago
Updated 28 March 2024, 9 months ago

Problem/Motivation

This is just a first quick report, as we found out that this issue only occurs on projects, where we're using VBO on the media_library view (but not on the Widget view displays, which makes this even more strange).

Steps to reproduce

When using VBO as field on the master view, but overwriting the widget displays to not use VBO, but the media selection instead, the following happens:
- If the view isn't filtered in the media selection modal, everything is fine and works as expected
- When using the filter in the Media library widget modal (Media Entity Reference field) and for example filtering for a media ID or a name, the checkboxes to select the media files disappear
- When removing the filter agian, by deleting the filter value and clicking filter again, the checkboxes are back again

Another strange effect is, that this bug only appears in the modal, not when trying the same in the view preview at /admin/structure/views/view/media_library/edit/widget

Any ideas how that can happen, especially as VBO isn't used in this views display?

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Active

Version

4.2

Component

Core

Created by

🇩🇪Germany Anybody Porta Westfalica

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

Comments & Activities

  • Issue created by @Anybody
  • 🇩🇪Germany Anybody Porta Westfalica
  • 🇩🇪Germany Anybody Porta Westfalica

    Any ideas how VBO could leak into the other view displays? That information might help a lot to find the root cause.

  • 🇩🇪Germany Anybody Porta Westfalica

    PS: I have to admit, I'm still not 100% sure it's a VBO bug. There's still a chance that it's a Core Media Library bug. We'll have to dig deeper...

  • 🇧🇪Belgium flyke

    I have a media library view with VBO that was working on Drupal 9, but is no longer working after updating to Drupal 10.
    The HTML structure regarding VBO is entirely different as you can see in these screenshots.
    In D10, the

    Haven't figured out exact cause or solution yet, only that update from D9 to D10 caused it to not work.
    Whatever core logic does something with 'media_bulk_form' might be the culprit.
  • 🇧🇪Belgium flyke

    This section is new in claro.theme in Drupal 10. The claro.theme in Drupal 9 does not contain any 'bulk_actions_container' reference.
    Need more time and testing but It's possible this is causing it

  • 🇧🇪Belgium flyke

    It's only this single line that causes the problem (core/themes/claro/claro.theme around line 446):
    unset($form['header'][$key]);
    Comment out that line and VBO works on the Media Library !

    I am now busy with another problem: in my project, VBO only works well on the first page of the Media Library.
    If I select items on the second page (using the views pager to go to page 2 of the media library items) then VBO still thinks I am selecting items on the first page.

    Example: if your pager shows 10 media items per page, and you have 20 media items and you are on page 2 and you select for example the first and third item of page two (which are the 11th and 13th media items) and choose the unpublish VBO action, then media item 1 and 3 will be unpublished instead of 11 and 13 :-|

  • 🇯🇴Jordan Ahmad Khader

    Please check if this issues ticket's patch to Missing views bulk operations on the media library view. 🐛 Missing views bulk operations on the media library view Needs review

Production build 0.71.5 2024