mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2026-07-22 05:53:03 -04:00
Fixed search not closing on same anchor selection
This commit is contained in:
@@ -25,6 +25,7 @@ import {
|
||||
Observable,
|
||||
ObservableInput,
|
||||
filter,
|
||||
fromEvent,
|
||||
merge,
|
||||
mergeWith
|
||||
} from "rxjs"
|
||||
@@ -112,6 +113,15 @@ export function mountSearch(
|
||||
const query = getComponentElement("search-query", el)
|
||||
const result = getComponentElement("search-result", el)
|
||||
|
||||
/* Always close search on result selection */
|
||||
fromEvent<PointerEvent>(el, "click")
|
||||
.pipe(
|
||||
filter(({ target }) => (
|
||||
target instanceof Element && !!target.closest("a")
|
||||
))
|
||||
)
|
||||
.subscribe(() => setToggle("search", false))
|
||||
|
||||
/* Set up search keyboard handlers */
|
||||
keyboard$
|
||||
.pipe(
|
||||
|
||||
Reference in New Issue
Block a user