Work-around for the scroll position when inserting quotes on iOS
authorAlexander Ebert <ebert@woltlab.com>
Sat, 10 Apr 2021 12:35:53 +0000 (14:35 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Sat, 10 Apr 2021 12:35:53 +0000 (14:35 +0200)
wcfsetup/install/files/js/WCF.Message.js

index f8cf41363b91e9042e362f0b79debd671977e9ad..ed4843597da175fb88840f837883e4b641922518 100644 (file)
@@ -2084,7 +2084,19 @@ if (COMPILER_TARGET_DEFAULT) {
                        
                        // close dialog
                        if (event !== null) {
-                               this._dialog.wcfDialog('close');
+                               require(["WoltLabSuite/Core/Environment"], (function (Environment) {
+                                       var callback = (function () {
+                                               this._dialog.wcfDialog("close");
+                                       }).bind(this);
+
+                                       // Slightly delay the closing of the overlay, preventing some unexpected
+                                       // changes to the scroll position on iOS.
+                                       if (Environment.platform() === "ios") {
+                                               window.setTimeout(callback, 100);
+                                       } else {
+                                               callback();
+                                       }
+                               }.bind(this)));
                        }
                },