From: Alexander Ebert Date: Wed, 29 Sep 2021 12:06:09 +0000 (+0200) Subject: Force blur the editor after replying with a message X-Git-Tag: 5.4.9_dev_1~60 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=9bf6dbcef37c2efc074c3088a9a97c94f772a5ec;p=GitHub%2FWoltLab%2FWCF.git Force blur the editor after replying with a message See https://community.woltlab.com/thread/292195-probleme-mit-opera-mobile-unter-android/ --- diff --git a/ts/WoltLabSuite/Core/Ui/Message/Reply.ts b/ts/WoltLabSuite/Core/Ui/Message/Reply.ts index 9d10931f36..0deada02a1 100644 --- a/ts/WoltLabSuite/Core/Ui/Message/Reply.ts +++ b/ts/WoltLabSuite/Core/Ui/Message/Reply.ts @@ -273,6 +273,13 @@ class UiMessageReply { this._getEditor().code.set("

\u200b

"); 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); } /** diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Message/Reply.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Message/Reply.js index 1878749f05..0568749b40 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Message/Reply.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Message/Reply.js @@ -206,6 +206,15 @@ define(["require", "exports", "tslib", "../../Ajax", "../../Core", "../../Event/ _reset() { this._getEditor().code.set("

\u200b

"); 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.