From e84879017faf8ec2dcb4a5a1b38bba1445c10b7b Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Fri, 31 Dec 2021 14:58:12 +0100 Subject: [PATCH] The mobile menu was bricking the login/reauthentication view --- ts/WoltLabSuite/Core/Ui/Mobile.ts | 12 ++++++++---- wcfsetup/install/files/acp/style/layout.scss | 5 +++++ wcfsetup/install/files/acp/templates/pageHeader.tpl | 2 +- .../install/files/js/WoltLabSuite/Core/Ui/Mobile.js | 10 +++++++--- .../install/files/lib/acp/form/LoginForm.class.php | 1 + .../lib/acp/form/ReauthenticationForm.class.php | 8 ++++++++ 6 files changed, 30 insertions(+), 8 deletions(-) diff --git a/ts/WoltLabSuite/Core/Ui/Mobile.ts b/ts/WoltLabSuite/Core/Ui/Mobile.ts index 7af8c4d6da..ec04d87346 100644 --- a/ts/WoltLabSuite/Core/Ui/Mobile.ts +++ b/ts/WoltLabSuite/Core/Ui/Mobile.ts @@ -19,6 +19,7 @@ import { PageMenuMainProvider } from "./Page/Menu/Main/Provider"; import { hasValidUserMenu, PageMenuUser } from "./Page/Menu/User"; import * as UiScreen from "./Screen"; +const _isAcp = document.body.classList.contains("wcfAcp"); let _dropdownMenu: HTMLUListElement | null = null; let _dropdownMenuMessage: HTMLElement | null = null; let _enabled = false; @@ -51,6 +52,11 @@ function initSearchButton(): void { const searchBar = document.getElementById("pageHeaderSearch")!; const searchInput = document.getElementById("pageHeaderSearchInput")!; + // The search bar is unavailable during WCFSetup or the login. + if (_isAcp && searchBar === null) { + return; + } + let scrollTop: number | null = null; const searchButton = document.getElementById("pageHeaderSearchMobile")!; searchButton.addEventListener("click", (event) => { @@ -97,9 +103,7 @@ function initSearchButton(): void { }); UiCloseOverlay.add("WoltLabSuite/Core/Ui/MobileSearch", (origin, identifier) => { - const isAcp = document.body.classList.contains("wcfAcp"); - - if (!isAcp && origin === Origin.DropDown) { + if (!_isAcp && origin === Origin.DropDown) { const button = document.getElementById("pageHeaderSearchTypeSelect")!; if (button.dataset.target === identifier) { return; @@ -107,7 +111,7 @@ function initSearchButton(): void { } closeSearch(searchBar, scrollTop); - if (!isAcp) { + if (!_isAcp) { closeSearchBar(); } diff --git a/wcfsetup/install/files/acp/style/layout.scss b/wcfsetup/install/files/acp/style/layout.scss index 6230b5a354..d86f982435 100644 --- a/wcfsetup/install/files/acp/style/layout.scss +++ b/wcfsetup/install/files/acp/style/layout.scss @@ -295,6 +295,11 @@ $wcfAcpSubMenuWidth: 300px; .pageHeader { grid-template-areas: "logo woltlab jumpToPage search menu user"; grid-template-columns: auto repeat(5, max-content); + + &[data-is-login="true"] { + grid-template-areas: "logo"; + grid-template-columns: auto; + } } .pageHeaderPanel > .layoutBoundary { diff --git a/wcfsetup/install/files/acp/templates/pageHeader.tpl b/wcfsetup/install/files/acp/templates/pageHeader.tpl index e05b968e39..99e2f5b9ed 100644 --- a/wcfsetup/install/files/acp/templates/pageHeader.tpl +++ b/wcfsetup/install/files/acp/templates/pageHeader.tpl @@ -1,5 +1,5 @@
-