Force blur the editor after replying with a message
authorAlexander Ebert <ebert@woltlab.com>
Wed, 29 Sep 2021 12:06:09 +0000 (14:06 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Wed, 29 Sep 2021 12:06:09 +0000 (14:06 +0200)
See https://community.woltlab.com/thread/292195-probleme-mit-opera-mobile-unter-android/

ts/WoltLabSuite/Core/Ui/Message/Reply.ts
wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Message/Reply.js

index 9d10931f3663d1bb05c6a73f24b59bd5f9f6d61f..0deada02a113c081994955770cada6449f8e6b16 100644 (file)
@@ -273,6 +273,13 @@ class UiMessageReply {
     this._getEditor().code.set("<p>\u200b</p>");
 
     EventHandler.fire("com.woltlab.wcf.redactor2", "reset_text");
+
+    // Opera on Android does not properly blur the editor after submitting the message,
+    // causing the keyboard to vanish, but the focus remains inside the editor.
+    window.setTimeout(() => {
+      const editor = document.activeElement?.closest(".redactor-layer");
+      }
+    }, 50);
   }
 
   /**
index 1878749f0545dccd75a36845273cff48d712d7c6..0568749b4027d44b2a6e3461f3f718f9b8298f78 100644 (file)
@@ -206,6 +206,15 @@ define(["require", "exports", "tslib", "../../Ajax", "../../Core", "../../Event/
         _reset() {
             this._getEditor().code.set("<p>\u200b</p>");
             EventHandler.fire("com.woltlab.wcf.redactor2", "reset_text");
+            // Opera on Android does not properly blur the editor after submitting the message,
+            // causing the keyboard to vanish, but the focus remains inside the editor.
+            window.setTimeout(() => {
+                var _a;
+                const editor = (_a = document.activeElement) === null || _a === void 0 ? void 0 : _a.closest(".redactor-layer");
+                if (editor && editor instanceof HTMLElement) {
+                    editor.blur();
+                }
+            }, 50);
         }
         /**
          * Handles errors occurred during server processing.