fix: use display instead of visibility for click handling pasthrough

This commit is contained in:
Jacky Zhao 2024-02-02 01:24:40 -08:00
parent 5ab922f316
commit a0b927da4a
2 changed files with 7 additions and 4 deletions

View File

@ -188,7 +188,7 @@ document.addEventListener("nav", async (e: CustomEventMap["nav"]) => {
removeAllChildren(preview) removeAllChildren(preview)
} }
if (searchLayout) { if (searchLayout) {
searchLayout.style.visibility = "hidden" searchLayout.classList.remove("display-results")
} }
searchType = "basic" // reset search type after closing searchType = "basic" // reset search type after closing
@ -424,7 +424,7 @@ document.addEventListener("nav", async (e: CustomEventMap["nav"]) => {
async function onType(e: HTMLElementEventMap["input"]) { async function onType(e: HTMLElementEventMap["input"]) {
if (!searchLayout || !index) return if (!searchLayout || !index) return
currentSearchTerm = (e.target as HTMLInputElement).value currentSearchTerm = (e.target as HTMLInputElement).value
searchLayout.style.visibility = currentSearchTerm === "" ? "hidden" : "visible" searchLayout.classList.toggle("display-results", currentSearchTerm !== "")
searchType = currentSearchTerm.startsWith("#") ? "tags" : "basic" searchType = currentSearchTerm.startsWith("#") ? "tags" : "basic"
let searchResults: FlexSearch.SimpleDocumentSearchResultSetUnit[] let searchResults: FlexSearch.SimpleDocumentSearchResultSetUnit[]

View File

@ -83,11 +83,14 @@
} }
& > #search-layout { & > #search-layout {
display: flex; display: none;
flex-direction: row; flex-direction: row;
visibility: hidden;
border: 1px solid var(--lightgray); border: 1px solid var(--lightgray);
&.display-results {
display: flex;
}
@media all and (min-width: $tabletBreakpoint) { @media all and (min-width: $tabletBreakpoint) {
&[data-preview] { &[data-preview] {
& .result-card > p.preview { & .result-card > p.preview {