From dacf9ae753b26a50c2976ce0f76212eca082bc1a Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Fri, 7 Oct 2016 16:06:01 +0200 Subject: [PATCH] Fixed dialog position for Chrome for Android --- .../files/js/WoltLabSuite/Core/Ui/Dialog.js | 2 ++ .../files/js/WoltLabSuite/Core/Ui/Screen.js | 21 +++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Dialog.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Dialog.js index e1615e13bf..01596f0109 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Dialog.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Dialog.js @@ -72,6 +72,8 @@ define( this._initStaticDialogs(); DomChangeListener.add('Ui/Dialog', this._initStaticDialogs.bind(this)); + + UiScreen.setDialogContainer(_container); }, _initStaticDialogs: function() { diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Screen.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Screen.js index 4c54d03f75..dfdc3cd870 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Screen.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Screen.js @@ -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 -- 2.20.1