From: Alexander Ebert Date: Tue, 18 Jul 2023 13:38:18 +0000 (+0200) Subject: Restore the mobile search icon when closing the search X-Git-Tag: 6.0.0_Alpha_7~14 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=69838659446f5016bfb32111653ccd0238e66241;p=GitHub%2FWoltLab%2FWCF.git Restore the mobile search icon when closing the search See https://www.woltlab.com/community/thread/300653-mobiles-such-icon-%C3%A4ndert-seinen-status-nicht/ --- diff --git a/ts/WoltLabSuite/Core/Ui/Search.ts b/ts/WoltLabSuite/Core/Ui/Search.ts index 8934b0148a..ae55b5fe43 100644 --- a/ts/WoltLabSuite/Core/Ui/Search.ts +++ b/ts/WoltLabSuite/Core/Ui/Search.ts @@ -86,9 +86,6 @@ function initMobileSearch(): void { if (searchButton.getAttribute("aria-expanded") === "true") { closeSearch(); - - searchButton.setAttribute("aria-expanded", "false"); - searchButton.querySelector("fa-icon")!.setIcon("magnifying-glass"); } else { // iOS Safari behaves unpredictable when the keyboard focus // is moved into a HTML element that is inside a parent with @@ -120,9 +117,6 @@ function initMobileSearch(): void { event.preventDefault(); closeSearch(); - - searchButton.setAttribute("aria-expanded", "false"); - searchButton.querySelector("fa-icon")!.setIcon("magnifying-glass"); } }); } @@ -179,6 +173,12 @@ function closeSearch(): void { _pageHeaderSearchInput.blur(); } + const searchButton = document.getElementById("pageHeaderSearchMobile"); + if (searchButton) { + searchButton.setAttribute("aria-expanded", "false"); + searchButton.querySelector("fa-icon")!.setIcon("magnifying-glass"); + } + const scope = _pageHeaderSearch.querySelector(".pageHeaderSearchType")!; UiDropdownSimple.close(scope.id); } diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Search.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Search.js index 15a4e29f39..b8b364d662 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Search.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Search.js @@ -76,8 +76,6 @@ define(["require", "exports", "tslib", "../Event/Handler", "./Alignment", "./Clo event.stopPropagation(); if (searchButton.getAttribute("aria-expanded") === "true") { closeSearch(); - searchButton.setAttribute("aria-expanded", "false"); - searchButton.querySelector("fa-icon").setIcon("magnifying-glass"); } else { // iOS Safari behaves unpredictable when the keyboard focus @@ -103,8 +101,6 @@ define(["require", "exports", "tslib", "../Event/Handler", "./Alignment", "./Clo if (event.target === _pageHeaderSearch) { event.preventDefault(); closeSearch(); - searchButton.setAttribute("aria-expanded", "false"); - searchButton.querySelector("fa-icon").setIcon("magnifying-glass"); } }); } @@ -149,6 +145,11 @@ define(["require", "exports", "tslib", "../Event/Handler", "./Alignment", "./Clo if (_isMobile) { _pageHeaderSearchInput.blur(); } + const searchButton = document.getElementById("pageHeaderSearchMobile"); + if (searchButton) { + searchButton.setAttribute("aria-expanded", "false"); + searchButton.querySelector("fa-icon").setIcon("magnifying-glass"); + } const scope = _pageHeaderSearch.querySelector(".pageHeaderSearchType"); Simple_1.default.close(scope.id); }