diff options
author | fenn-cs <fenn25.fn@gmail.com> | 2023-11-28 11:01:31 +0100 |
---|---|---|
committer | nextcloud-command <nextcloud-command@users.noreply.github.com> | 2023-11-30 15:33:08 +0000 |
commit | daafc733faf5517ed39ca4f68a18af6587e2ab88 (patch) | |
tree | 5e055d9c4aef3d5556adc1dc535c61e25200cc5a /core/src | |
parent | 996d94a0de4832642939c1546f46f89278262b85 (diff) | |
download | nextcloud-server-daafc733faf5517ed39ca4f68a18af6587e2ab88.tar.gz nextcloud-server-daafc733faf5517ed39ca4f68a18af6587e2ab88.zip |
Handle close GlobalSearchModal gracefully
The current close infrastructure modifies a prop which has
no real effect aside bugs.
In addition, calling the `NcModal.close()` as the primary way to
close the search modal instead of using the states defined in `GlobalSearch` view
causing re-open bugs (Modal cannot open, needs to click twice, and other weird stuff).
Signed-off-by: fenn-cs <fenn25.fn@gmail.com>
Signed-off-by: nextcloud-command <nextcloud-command@users.noreply.github.com>
Diffstat (limited to 'core/src')
-rw-r--r-- | core/src/views/GlobalSearch.vue | 5 | ||||
-rw-r--r-- | core/src/views/GlobalSearchModal.vue | 10 |
2 files changed, 12 insertions, 3 deletions
diff --git a/core/src/views/GlobalSearch.vue b/core/src/views/GlobalSearch.vue index 2bca15ec905..24547fd6270 100644 --- a/core/src/views/GlobalSearch.vue +++ b/core/src/views/GlobalSearch.vue @@ -26,7 +26,7 @@ <Magnify class="global-search__trigger" :size="22" /> </template> </NcButton> - <GlobalSearchModal :is-visible="showGlobalSearch" :class="'global-search-modal'" /> + <GlobalSearchModal :class="'global-search-modal'" :is-visible="showGlobalSearch" @update:isVisible="handleModalVisibilityChange" /> </div> </template> @@ -54,6 +54,9 @@ export default { toggleGlobalSearch() { this.showGlobalSearch = !this.showGlobalSearch }, + handleModalVisibilityChange(newVisibilityVal) { + this.showGlobalSearch = newVisibilityVal + }, }, } </script> diff --git a/core/src/views/GlobalSearchModal.vue b/core/src/views/GlobalSearchModal.vue index b8a302a15bf..cfed7543e0d 100644 --- a/core/src/views/GlobalSearchModal.vue +++ b/core/src/views/GlobalSearchModal.vue @@ -2,7 +2,7 @@ <NcModal id="global-search" ref="globalSearchModal" :name="t('core', 'Global search')" - :show.sync="isVisible" + :show.sync="internalIsVisible" :clear-view-delay="0" :title="t('Global search')" @close="closeModal"> @@ -201,6 +201,7 @@ export default { contacts: [], debouncedFind: debounce(this.find, 300), showDateRangeModal: false, + internalIsVisible: false, } }, @@ -225,12 +226,17 @@ export default { }, watch: { isVisible(value) { + this.internalIsVisible = value + }, + internalIsVisible(value) { + this.$emit('update:isVisible', value) this.$nextTick(() => { if (value) { this.focusInput() } }) }, + }, mounted() { getProviders().then((providers) => { @@ -516,7 +522,7 @@ export default { this.$refs.searchInput.$el.children[0].children[0].focus() }, closeModal() { - this.$refs.globalSearchModal.close() + this.internalIsVisible = false this.searchQuery = '' }, supportFiltering() { |