summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--core/modules/media_library/js/media_library.ui.js4
1 files changed, 3 insertions, 1 deletions
diff --git a/core/modules/media_library/js/media_library.ui.js b/core/modules/media_library/js/media_library.ui.js
index 4ff97d57dc1e..10fe212f4a57 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;
});
},
};