From ea4288b064fe38c5eef70e61604b44cce9ef6f47 Mon Sep 17 00:00:00 2001 From: Serraniel Date: Wed, 29 Jul 2020 20:06:28 +0200 Subject: [PATCH] #12 Fixed issue that last dropdown will pop in wrong position --- enhancements/quickSearch.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/enhancements/quickSearch.js b/enhancements/quickSearch.js index 212e7aa..8468276 100644 --- a/enhancements/quickSearch.js +++ b/enhancements/quickSearch.js @@ -33,6 +33,9 @@ function initSearch() { // register focus hotkey document.addEventListener('keypress', event => handleSearchForShiftF(event)); + + // additionally, the last dropdown ul has a "right: 0px" style, which has to be fixed with auto, otherwhise it will pop up in the wrong position + Array.from(menu.querySelectorAll('ul.dropdown')).slice(-1)[0].style.right = 'auto'; } function handleQuickSearch(event) { @@ -44,6 +47,7 @@ function handleQuickSearch(event) { url.pathname = '/search'; url.searchParams.append('q', quickSearchElement.value); + // clicking the link; we are not setting window.location because this will trigger a complete reload of the site linkElement.href = `${url.pathname}${url.search}`; linkElement.click();