diff --git a/core/modules/media_library/js/media_library.ui.js b/core/modules/media_library/js/media_library.ui.js index 4ff97d57dc1edfabd9d3cd2289454c7b53fc98c2..10fe212f4a57af7ed7a51304fc21ee252575ea3b 100644 --- a/core/modules/media_library/js/media_library.ui.js +++ b/core/modules/media_library/js/media_library.ui.js @@ -410,7 +410,9 @@ return; } window.addEventListener('dialog:afterclose', () => { - Drupal.MediaLibrary.currentSelection = []; + // This empty the array while keeping the existing array reference, + // to keep event listeners working. + Drupal.MediaLibrary.currentSelection.length = 0; }); }, };