Fixed dialog position for Chrome for Android
authorAlexander Ebert <ebert@woltlab.com>
Fri, 7 Oct 2016 14:06:01 +0000 (16:06 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Fri, 7 Oct 2016 14:06:06 +0000 (16:06 +0200)
wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Dialog.js
wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Screen.js

index e1615e13bf8981da51c8a13432b2a107bbf494c6..01596f010904534235bf3e715efb9cda8e38f70c 100644 (file)
@@ -72,6 +72,8 @@ define(
                        
                        this._initStaticDialogs();
                        DomChangeListener.add('Ui/Dialog', this._initStaticDialogs.bind(this));
+                       
+                       UiScreen.setDialogContainer(_container);
                },
                
                _initStaticDialogs: function() {
index 4c54d03f757071a46e2037739a4701811d00d914..dfdc3cd870af697d603fa0e2ea9d4c07ec60aadd 100644 (file)
@@ -9,6 +9,7 @@
 define(['Core', 'Dictionary', 'Environment'], function(Core, Dictionary, Environment) {
        "use strict";
        
+       var _dialogContainer = null;
        var _mql = new Dictionary();
        var _scrollDisableCounter = 0;
        var _scrollOffsetFrom = null;
@@ -113,6 +114,11 @@ define(['Core', 'Dictionary', 'Environment'], function(Core, Dictionary, Environ
                                }
                                else {
                                        pageContainer.style.setProperty('transform', 'translateY(-' + _scrollTop + 'px)', '');
+                                       
+                                       if (_dialogContainer !== null) {
+                                               // the same value for `pageContainer` but in reverse
+                                               _dialogContainer.style.setProperty('transform', 'translateY(' + _scrollTop + 'px)', '');
+                                       }
                                }
                                
                                document.documentElement.classList.add('disableScrolling');
@@ -138,6 +144,10 @@ define(['Core', 'Dictionary', 'Environment'], function(Core, Dictionary, Environ
                                        }
                                        else {
                                                pageContainer.style.removeProperty('transform');
+                                               
+                                               if (_dialogContainer !== null) {
+                                                       _dialogContainer.style.removeProperty('transform');
+                                               }
                                        }
                                        
                                        if (_scrollTop) {
@@ -147,6 +157,17 @@ define(['Core', 'Dictionary', 'Environment'], function(Core, Dictionary, Environ
                        }
                },
                
+               /**
+                * Sets the dialog container element. This method is used to
+                * circumvent a possible circular dependency, due to `Ui/Dialog`
+                * requiring the `Ui/Screen` module itself.
+                * 
+                * @param       {Element}       container       dialog container element
+                */
+               setDialogContainer: function (container) {
+                       _dialogContainer = container;
+               },
+               
                /**
                 * 
                 * @param       {string}        query   CSS media query