From: Alexander Ebert Date: Mon, 10 Oct 2016 10:34:13 +0000 (+0200) Subject: Fixed search bar behavior on iOS X-Git-Tag: 3.0.0_Beta_3~50^2~24 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=374fb74a0b31d7c9acf3d7c754749c72dc0e70d0;p=GitHub%2FWoltLab%2FWCF.git Fixed search bar behavior on iOS Focusing a text input turns `position: fixed` into `position: absolute` on iOS. Fixes #2111 --- diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Mobile.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Mobile.js index 6c5f7c3cb3..e8a7be8819 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Mobile.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Mobile.js @@ -119,17 +119,35 @@ define( var _searchBar = elById('pageHeaderSearch'); var _searchInput = elById('pageHeaderSearchInput'); + var scrollTop = null; + EventHandler.add('com.woltlab.wcf.MainMenuMobile', 'more', function(data) { if (data.identifier === 'com.woltlab.wcf.search') { + data.handler.close(true); + + if (Environment.platform() === 'ios') { + scrollTop = document.body.scrollTop; + UiScreen.scrollDisable(); + } + _searchBar.style.setProperty('top', elById('pageHeader').offsetHeight + 'px', ''); _searchBar.classList.add('open'); _searchInput.focus(); - data.handler.close(true); + if (Environment.platform() === 'ios') { + document.body.scrollTop = 0; + } } }); - _main.addEventListener(WCF_CLICK_EVENT, function() { _searchBar.classList.remove('open'); }); + _main.addEventListener(WCF_CLICK_EVENT, function() { + _searchBar.classList.remove('open'); + + if (Environment.platform() === 'ios') { + UiScreen.scrollEnable(); + document.body.scrollTop = scrollTop; + } + }); }, _initButtonGroupNavigation: function() {