Problem/Motivation
Currently, modals created by Project Browser don't have their HTML removed from the DOM after they're closed. If the same "View Commands" button is clicked repeatedly, it creates new HTML that isn't removed until the page is refreshed or navigated away from.
Steps to reproduce
Use either major version of Project Browser - both 1.0.x-dev and 2.0.x-dev branches have this behavior.
| Comment | File | Size | Author |
|---|---|---|---|
| #14 | Screencast 2024-08-15 13-22-21.mp4 | 5.24 MB | snehal-chibde |
| #7 | close-modal.mp4 | 18.7 MB | snehal-chibde |
| modals-not-removed.mp4 | 2.59 MB | kwiseman |
Issue fork project_browser-3458908
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
chrisfromredfinComment #5
omkar-pd commentedComment #6
atul_ghate commentedI will review this issue.
Comment #7
snehal-chibde commentedhello @omkar-pd, I have tested the code in version 2.0.x-dev and now the modals are getting removed from DOM on click of close button. Added a video recording for reference.
Comment #8
atul_ghate commentedHi
I have reproduced the issue successfully...
I have tested MR 562 on the Drupal 10.3 version,
The MR is applied cleanly....
Test Result:
Modals created by Project Browser do have their HTML removed from the DOM after they're closed.
RTBC+1
Comment #10
chrisfromredfinI found that this would not remove the HTML if the dialog was closed using ESC. Using the Drupal.dialog() api, you can specify a handler to invoke when the modal is closed. I moved the code into there and it seems to be working.
Could someone re-test this with the latest, review my code, ensure it's working, and set it back to RTBC?
Comment #11
omkar-pd commentedTests failed.
Comment #12
chrisfromredfinNeeds manual tests, but automated tests were failing for flakiness only (retests passed).
Comment #13
omkar-pd commentedTested this locally. Removes Modals dialog on Esc and on close.
Comment #14
snehal-chibde commentedhello @chrisfromredfin, I have tested the code in version 2.0.x-dev and now the modals are getting removed from DOM on click of ESC button and Close Icon both. Added a video recording for reference.
Comment #16
chrisfromredfinThanks all, a good little cleanup!