From 9a96109ea23f165f0af097e7e9f77f604f4c993f Mon Sep 17 00:00:00 2001 From: Ludy Date: Sat, 23 Nov 2024 12:37:13 +0100 Subject: [PATCH] Fix: Prevents duplicate listing of search results (#2306) --- src/main/resources/static/js/search.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/resources/static/js/search.js b/src/main/resources/static/js/search.js index a4d292ea..85d69f84 100644 --- a/src/main/resources/static/js/search.js +++ b/src/main/resources/static/js/search.js @@ -28,7 +28,7 @@ window.onload = function () { // Show search results as user types in search box document.querySelector("#navbarSearchInput").addEventListener("input", function (e) { var searchText = e.target.value.trim().toLowerCase(); // Trim whitespace and convert to lowercase - var items = document.querySelectorAll(".dropdown-item, .nav-link"); + var items = document.querySelectorAll('a.dropdown-item[data-bs-tags]'); var resultsBox = document.querySelector("#searchResults"); // Clear any previous results @@ -83,7 +83,7 @@ searchDropdown.addEventListener('shown.bs.dropdown', function () { searchDropdown.addEventListener('mouseenter', function () { const dropdownInstance = new bootstrap.Dropdown(searchDropdown); dropdownInstance.show(); - + setTimeout(() => { searchInput.focus(); }, 100);