Incorrect focus/scroll management on iOS
authorAlexander Ebert <ebert@woltlab.com>
Wed, 20 Apr 2022 15:28:12 +0000 (17:28 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Wed, 20 Apr 2022 15:28:12 +0000 (17:28 +0200)
See https://www.woltlab.com/community/thread/295245-antworten-button-springt-zum-footer/

ts/WoltLabSuite/Core/Ui/Message/Reply.ts
ts/WoltLabSuite/Core/Ui/Redactor/Editor.ts
wcfsetup/install/files/js/3rdParty/redactor2/plugins/WoltLabReply.js
wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Message/Reply.js

index 98dfe9145a489a1a40c572d608dca8192b1cabfc..358d2a16a532d3c719a4a074f32a570bf1c7b360 100644 (file)
@@ -80,7 +80,7 @@ class UiMessageReply {
       replyButton.addEventListener("click", (event) => {
         event.preventDefault();
 
-        this._getEditor().WoltLabReply.showEditor();
+        this._getEditor().WoltLabReply.showEditor(true);
 
         UiScroll.element(this._container, () => {
           this._getEditor().WoltLabCaret.endOfEditor();
index a1b022875b5f180cd83df2c43b6e12f5d3e7d222..416973f3f4679d31d8579ed8f405f4300b469fc1 100644 (file)
@@ -60,7 +60,7 @@ export interface RedactorEditor {
     register(event: string, callback: (data: WoltLabEventData) => void): void;
   };
   WoltLabReply: {
-    showEditor(): void;
+    showEditor(skipFocus?: boolean): void;
   };
   WoltLabSource: {
     isActive(): boolean;
index 2a84964cd36dd9556879b31f7bf22ebf5ea2b786..0c5f22ab83246a7359f9cba9c981022cdedcd665 100644 (file)
@@ -23,10 +23,13 @@ $.Redactor.prototype.WoltLabReply = function() {
                        _messageContent.addEventListener('click', _callbackClick);
                },
                
-               showEditor: function () {
+               showEditor: function (skipFocus = false) {
                        if (!_messageQuickReply) {
                                // direct api call, but conditions are not met, be graceful
-                               this.WoltLabCaret.endOfEditor();
+                               if (!skipFocus) {
+                                       this.WoltLabCaret.endOfEditor();
+                               }
+                               
                                return;
                        }
                        else if (!_messageQuickReply.classList.contains('messageQuickReplyCollapsed')) {
@@ -36,7 +39,9 @@ $.Redactor.prototype.WoltLabReply = function() {
                        _messageQuickReply.classList.remove('messageQuickReplyCollapsed');
                        _messageContent.removeEventListener('click', _callbackClick);
                        
-                       this.WoltLabCaret.endOfEditor();
+                       if (!skipFocus) {
+                               this.WoltLabCaret.endOfEditor();
+                       }
                },
                
                _click: function (event) {
index 09a9c243e303826d470d6b97d17a8d1133773f05..ed13bbfabf2acbab58ec2c6b5474ff20aa7ddbfd 100644 (file)
@@ -47,7 +47,7 @@ define(["require", "exports", "tslib", "../../Ajax", "../../Core", "../../Event/
             document.querySelectorAll(".jsQuickReply").forEach((replyButton) => {
                 replyButton.addEventListener("click", (event) => {
                     event.preventDefault();
-                    this._getEditor().WoltLabReply.showEditor();
+                    this._getEditor().WoltLabReply.showEditor(true);
                     UiScroll.element(this._container, () => {
                         this._getEditor().WoltLabCaret.endOfEditor();
                     });