diff --git a/app/components/AppHeader.vue b/app/components/AppHeader.vue
index 8f0cb2290..76148d115 100644
--- a/app/components/AppHeader.vue
+++ b/app/components/AppHeader.vue
@@ -151,6 +151,7 @@ const route = useRoute()
const isMobile = useIsMobile()
const isSearchExpandedManually = shallowRef(false)
const searchBoxRef = useTemplateRef('searchBoxRef')
+const searchContainerRef = useTemplateRef('searchContainerRef')
// On search page, always show search expanded on mobile
const isOnHomePage = computed(() => route.name === 'index')
@@ -188,6 +189,12 @@ function handleSearchBlur() {
}
}
+onClickOutside(searchContainerRef, () => {
+ if (isMobile.value && !isOnSearchPage.value) {
+ isSearchExpandedManually.value = false
+ }
+})
+
function handleSearchFocus() {
showFullSearch.value = true
}
@@ -215,7 +222,7 @@ onKeyStroke(