Skip to content

Commit d7c4bdc

Browse files
PytalPVince81
authored andcommitted
Close global search menu when focus leaves
Signed-off-by: Christopher Ng <chrng8@gmail.com>
1 parent f021172 commit d7c4bdc

File tree

4 files changed

+16
-5
lines changed

4 files changed

+16
-5
lines changed

core/src/components/HeaderMenu.vue

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@
3636
<div v-show="opened"
3737
:id="`header-menu-${id}`"
3838
class="header-menu__wrapper"
39-
role="menu">
39+
role="menu"
40+
@focusout="handleFocusOut">
4041
<div class="header-menu__content">
4142
<slot />
4243
</div>
@@ -161,6 +162,12 @@ export default {
161162
this.$emit('update:open', false)
162163
}
163164
},
165+
166+
handleFocusOut(event) {
167+
if (!event.currentTarget.contains(event.relatedTarget)) {
168+
this.closeMenu()
169+
}
170+
},
164171
},
165172
}
166173
</script>

core/src/views/UnifiedSearch.vue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,11 @@
7373
</form>
7474

7575
<!-- Search filters -->
76-
<NcActions v-if="availableFilters.length > 1" class="unified-search__filters" placement="bottom">
76+
<NcActions v-if="availableFilters.length > 1"
77+
class="unified-search__filters"
78+
placement="bottom"
79+
container=".unified-search__input-wrapper">
80+
<!-- FIXME use element ref for container after https://github.com/nextcloud/nextcloud-vue/pull/3462 -->
7781
<NcActionButton v-for="type in availableFilters"
7882
:key="type"
7983
icon="icon-filter"

dist/core-unified-search.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/core-unified-search.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)