fix for issue "Search Component Doesn't work if in beforeBody section #1905"

This commit is contained in:
Gassandrid 2025-04-04 10:01:47 -04:00
parent f334e78ed6
commit 223884423b

View File

@ -147,7 +147,7 @@ async function setupSearch(searchElement: Element, currentSlug: FullSlug, data:
const container = searchElement.querySelector(".search-container") as HTMLElement
if (!container) return
const sidebar = container.closest(".sidebar") as HTMLElement
const sidebar = container.closest(".sidebar") || document.body
if (!sidebar) return
const searchButton = searchElement.querySelector(".search-button") as HTMLButtonElement