Skip to content

fix(ui): orphaned Select2 dropdowns remaining visible when their parent container is replaced - #25053

Open
eduardomozart wants to merge 3 commits into
glpi-project:11.0/bugfixesfrom
eduardomozart:fix-issue-17504
Open

fix(ui): orphaned Select2 dropdowns remaining visible when their parent container is replaced#25053
eduardomozart wants to merge 3 commits into
glpi-project:11.0/bugfixesfrom
eduardomozart:fix-issue-17504

Conversation

@eduardomozart

Copy link
Copy Markdown
Contributor

…AJAX

Checklist before requesting a review

Please delete options that are not relevant.

  • I have read the CONTRIBUTING document.
  • I have performed a self-review of my code.
  • I have added tests that prove my fix is effective or that my feature works.
  • This change requires a documentation update.

Description

This PR fixes a UI bug where a Select2 sub-dropdown (e.g., triggered by selecting "Update" in Massive Actions) remains visibly stranded on the screen if the user subsequently chooses a different massive action (like "Add to transfer list") while the sub-dropdown is still open (Closes #17504).

Because GLPI's massive action sub-forms are replaced dynamically via AJAX (jQuery.load()), removing a Select2's underlying <select> element from the DOM without calling .select2('destroy') fails to remove its floating container popup from the <body>.

Changes

  • Updated src/Ajax.php (updateItemJsCode()) to automatically find and destroy any active .select2-hidden-accessible instances inside the target container right before .load() replaces the DOM elements.
  • Applied the same fix to the client-side JavaScript equivalent updateItemOnEvent() in js/common.js.

Screenshots (if appropriate):

Gravacao.de.Tela.2026-07-30.as.22.31.04.mov

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dropdown menu is still shown when selecting "Add to transfer list"

2 participants