fix(search): make closest sidebar z-index adjustment optional (closes #1905)
This commit is contained in:
		@@ -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()
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user