Fixed search not closing on same anchor selection

This commit is contained in:
squidfunk 2023-01-08 10:53:48 +01:00
parent 68257348b8
commit 8a812aed83
4 changed files with 18 additions and 8 deletions

View File

@ -240,7 +240,7 @@
</script>
{% endblock %}
{% block scripts %}
<script src="{{ 'assets/javascripts/bundle.a6761dc7.min.js' | url }}"></script>
<script src="{{ 'assets/javascripts/bundle.56861ea1.min.js' | url }}"></script>
{% for path in config.extra_javascript %}
<script src="{{ path | url }}"></script>
{% endfor %}

View File

@ -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(