fix(search): make closest sidebar z-index adjustment optional (closes #1905)
This commit is contained in:
parent
4d6e7ccba9
commit
3ae89a1d16
1 changed files with 3 additions and 4 deletions
|
@ -147,8 +147,7 @@ async function setupSearch(searchElement: Element, currentSlug: FullSlug, data:
|
||||||
const container = searchElement.querySelector(".search-container") as HTMLElement
|
const container = searchElement.querySelector(".search-container") as HTMLElement
|
||||||
if (!container) return
|
if (!container) return
|
||||||
|
|
||||||
const sidebar = container.closest(".sidebar") as HTMLElement
|
const sidebar = container.closest(".sidebar") as HTMLElement | null
|
||||||
if (!sidebar) return
|
|
||||||
|
|
||||||
const searchButton = searchElement.querySelector(".search-button") as HTMLButtonElement
|
const searchButton = searchElement.querySelector(".search-button") as HTMLButtonElement
|
||||||
if (!searchButton) return
|
if (!searchButton) return
|
||||||
|
@ -180,7 +179,7 @@ async function setupSearch(searchElement: Element, currentSlug: FullSlug, data:
|
||||||
function hideSearch() {
|
function hideSearch() {
|
||||||
container.classList.remove("active")
|
container.classList.remove("active")
|
||||||
searchBar.value = "" // clear the input when we dismiss the search
|
searchBar.value = "" // clear the input when we dismiss the search
|
||||||
sidebar.style.zIndex = ""
|
if (sidebar) sidebar.style.zIndex = ""
|
||||||
removeAllChildren(results)
|
removeAllChildren(results)
|
||||||
if (preview) {
|
if (preview) {
|
||||||
removeAllChildren(preview)
|
removeAllChildren(preview)
|
||||||
|
@ -192,7 +191,7 @@ async function setupSearch(searchElement: Element, currentSlug: FullSlug, data:
|
||||||
|
|
||||||
function showSearch(searchTypeNew: SearchType) {
|
function showSearch(searchTypeNew: SearchType) {
|
||||||
searchType = searchTypeNew
|
searchType = searchTypeNew
|
||||||
sidebar.style.zIndex = "1"
|
if (sidebar) sidebar.style.zIndex = "1"
|
||||||
container.classList.add("active")
|
container.classList.add("active")
|
||||||
searchBar.focus()
|
searchBar.focus()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue