mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-06-27 17:09:53 -04:00
WebUI: Close only focused modal
This commit is contained in:
parent
52bf8fb8d0
commit
db341a2e6e
1 changed files with 5 additions and 4 deletions
|
@ -1782,11 +1782,12 @@ window.addEventListener("DOMContentLoaded", (event) => {
|
|||
if (modalInstances.length <= 0)
|
||||
return;
|
||||
// MochaUI.currentModal does not update after a modal is closed
|
||||
// use `timestamp` for sequential closing
|
||||
const latestModal = modalInstances.reduce((prev, curr) => {
|
||||
return (prev.timestamp > curr.timestamp) ? prev : curr;
|
||||
const focusedModal = modalInstances.find((modal) => {
|
||||
return modal.windowEl.hasClass("isFocused");
|
||||
});
|
||||
latestModal.close();
|
||||
if (!focusedModal)
|
||||
return;
|
||||
focusedModal.close();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue