Disable the focus trap before hiding the dialog
authorAlexander Ebert <ebert@woltlab.com>
Mon, 25 Apr 2022 16:15:22 +0000 (18:15 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Mon, 25 Apr 2022 16:15:22 +0000 (18:15 +0200)
See https://www.woltlab.com/community/thread/295337-mobil-thema-bearbeiten-bug/

ts/WoltLabSuite/Core/Ui/Dialog.ts
wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Dialog.js

index b6a69fd9dbac6063208e42c1496776d669392fab..695b7b4cd98083a8b732a5fb8b78d43fc4d347c1 100644 (file)
@@ -764,6 +764,8 @@ const UiDialog = {
       throw new Error("Expected a valid dialog id, '" + id + "' does not match any active dialog.");
     }
 
+    data.focusTrap.deactivate();
+
     data.dialog.setAttribute("aria-hidden", "true");
 
     // Move the keyboard focus away from a now hidden element.
@@ -776,8 +778,6 @@ const UiDialog = {
       data.onClose(id);
     }
 
-    data.focusTrap.deactivate();
-
     // get next active dialog
     _activeDialog = null;
     for (let i = 0; i < _container.childElementCount; i++) {
index 9914ce484ceb861050fbd7d6ba72bbbb3cf0199e..18521fb4c221484fa1cab49dbb2b853f7be87be0 100644 (file)
@@ -627,6 +627,7 @@ define(["require", "exports", "tslib", "../Core", "../Dom/Change/Listener", "./S
             if (data === undefined) {
                 throw new Error("Expected a valid dialog id, '" + id + "' does not match any active dialog.");
             }
+            data.focusTrap.deactivate();
             data.dialog.setAttribute("aria-hidden", "true");
             // Move the keyboard focus away from a now hidden element.
             const activeElement = document.activeElement;
@@ -636,7 +637,6 @@ define(["require", "exports", "tslib", "../Core", "../Dom/Change/Listener", "./S
             if (typeof data.onClose === "function") {
                 data.onClose(id);
             }
-            data.focusTrap.deactivate();
             // get next active dialog
             _activeDialog = null;
             for (let i = 0; i < _container.childElementCount; i++) {