From 9bf6dbcef37c2efc074c3088a9a97c94f772a5ec Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Wed, 29 Sep 2021 14:06:09 +0200 Subject: [PATCH] Force blur the editor after replying with a message See https://community.woltlab.com/thread/292195-probleme-mit-opera-mobile-unter-android/ --- ts/WoltLabSuite/Core/Ui/Message/Reply.ts | 7 +++++++ .../files/js/WoltLabSuite/Core/Ui/Message/Reply.js | 9 +++++++++ 2 files changed, 16 insertions(+) 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. -- 2.20.1