Bug: admin-folders.js breaks “Select All” on wp-admin/update-core.php
-
Hi,
I found a JavaScript conflict caused by Responsive Lightbox on the WordPress Updates screen.
On:
/wp-admin/update-core.php
the “Select All” checkbox for plugin updates no longer selects the individual plugin checkboxes.The individual plugin checkboxes themselves work correctly.
I was able to isolate the issue to Responsive Lightbox. As soon as the plugin is deactivated, the WordPress “Select All” functionality works again.
Environment
- WordPress: 7.1.1
- Responsive Lightbox: 2.7.9
- Browser: Firefox
- Affected screen:
wp-admin/update-core.php
What I found
Responsive Lightbox loads the following admin scripts on the Updates screen:
/wp-content/plugins/responsive-lightbox/assets/select2/select2.full.min.js
/wp-content/plugins/responsive-lightbox/js/admin-folders.jsThe problematic behavior appears to come from
admin-folders.js.The script contains several checks such as:
if ("upload.php" !== rlFoldersArgs.page) {
return;
}However, these checks only protect individual functions or smaller code blocks.
The main initialization continues to execute on unrelated admin screens.
For example, when
rlFoldersArgs.pageis notupload.php, the script still falls back to list mode:o = e("body").hasClass("rl-folders-upload-grid-mode") ? "grid" : "list";and later calls:
j("list");which initializes jQuery UI draggable behavior on:
#the-list trThe script also registers several global handlers on
document, includingclick,change,keydown, andajaxComplete.This means the media folder functionality is partially initialized on
update-core.php, even though that screen is unrelated to the media library.Result
On the WordPress Updates screen:
#plugins-select-allreceivesclickandchangeevents correctly- individual plugin checkboxes work correctly
- manually setting the individual checkboxes via JavaScript works
- but the normal WordPress “Select All” behavior no longer works
Example manual test:
const checked = document.getElementById('plugins-select-all').checked;
document
.querySelectorAll('#update-plugins-table input[name="checked[]"]')
.forEach(el => {
el.checked = checked;
});This correctly selects all plugin checkboxes.
Expected behavior
admin-folders.jsshould only initialize its media folder functionality on the admin screens where it is actually required, for example:if (
rlFoldersArgs.page !== 'upload.php' &&
rlFoldersArgs.page !== 'media' &&
rlFoldersArgs.page !== 'media-new.php'
) {
return;
}or by conditionally enqueueing the script only on the relevant media screens.
Actual behavior
admin-folders.jsis loaded and partially initialized onupdate-core.php, which causes a conflict with WordPress core admin behavior.Could you please restrict the script initialization or enqueueing to the relevant media screens?
Thanks!
You must be logged in to reply to this topic.