From: Alexander Ebert Date: Tue, 24 May 2022 16:38:52 +0000 (+0200) Subject: Improved behavior of the mobile search X-Git-Tag: 5.5.0_Beta_4~19 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=b32a1f5baefb15e7c0c25dde4b15100a32686205;p=GitHub%2FWoltLab%2FWCF.git Improved behavior of the mobile search An already active overlay such as the mobile menu could cause the page to become scrollable. See https://www.woltlab.com/community/thread/295731-mobil-%C3%B6ffnen-der-suche-nach-%C3%B6ffnen-eines-men%C3%BCs-fehlerhaft/ --- diff --git a/ts/WoltLabSuite/Core/Ui/CloseOverlay.ts b/ts/WoltLabSuite/Core/Ui/CloseOverlay.ts index 980022ed87..04ce4fd7d2 100644 --- a/ts/WoltLabSuite/Core/Ui/CloseOverlay.ts +++ b/ts/WoltLabSuite/Core/Ui/CloseOverlay.ts @@ -15,6 +15,7 @@ const _callbackList = new CallbackList(); export enum Origin { Document = "document", DropDown = "dropdown", + Search = "search", } type Callback = (origin?: string | Origin, identifier?: string) => void; diff --git a/ts/WoltLabSuite/Core/Ui/Search.ts b/ts/WoltLabSuite/Core/Ui/Search.ts index 4b57e78294..6c6c189529 100644 --- a/ts/WoltLabSuite/Core/Ui/Search.ts +++ b/ts/WoltLabSuite/Core/Ui/Search.ts @@ -57,7 +57,9 @@ function initSearchBar(): void { }); UiCloseOverlay.add("WoltLabSuite/Core/Ui/Search", (origin, identifier) => { - if (origin === Origin.DropDown) { + if (origin === Origin.Search) { + return; + } else if (origin === Origin.DropDown) { const button = document.getElementById("pageHeaderSearchTypeSelect")!; if (button.dataset.target === identifier) { return; @@ -124,7 +126,7 @@ function initMobileSearch(): void { } function openSearch(): void { - UiCloseOverlay.execute(); + UiCloseOverlay.execute(Origin.Search); _pageHeader.classList.add("searchBarOpen"); _userPanelSearchButton?.parentElement!.classList.add("open"); diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/CloseOverlay.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/CloseOverlay.js index ff3eac2165..92344d36ce 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/CloseOverlay.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/CloseOverlay.js @@ -17,6 +17,7 @@ define(["require", "exports", "tslib", "../CallbackList"], function (require, ex (function (Origin) { Origin["Document"] = "document"; Origin["DropDown"] = "dropdown"; + Origin["Search"] = "search"; })(Origin = exports.Origin || (exports.Origin = {})); let hasGlobalListener = false; function add(identifier, callback) { diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Search.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Search.js index dc16344f2b..d05b6d6fa2 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Search.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Search.js @@ -52,7 +52,10 @@ define(["require", "exports", "tslib", "../Event/Handler", "./Alignment", "./Clo } }); CloseOverlay_1.default.add("WoltLabSuite/Core/Ui/Search", (origin, identifier) => { - if (origin === CloseOverlay_1.Origin.DropDown) { + if (origin === CloseOverlay_1.Origin.Search) { + return; + } + else if (origin === CloseOverlay_1.Origin.DropDown) { const button = document.getElementById("pageHeaderSearchTypeSelect"); if (button.dataset.target === identifier) { return; @@ -104,7 +107,7 @@ define(["require", "exports", "tslib", "../Event/Handler", "./Alignment", "./Clo }); } function openSearch() { - CloseOverlay_1.default.execute(); + CloseOverlay_1.default.execute(CloseOverlay_1.Origin.Search); _pageHeader.classList.add("searchBarOpen"); _userPanelSearchButton === null || _userPanelSearchButton === void 0 ? void 0 : _userPanelSearchButton.parentElement.classList.add("open"); if (!_isMobile) {