diff options
author | fenn-cs <fenn25.fn@gmail.com> | 2023-11-28 11:01:31 +0100 |
---|---|---|
committer | Andy Scherzinger <info@andy-scherzinger.de> | 2023-11-29 15:18:11 +0100 |
commit | 0d938cc90ed6ed9c42e15ea1198e0ed813db50cd (patch) | |
tree | 2e91e720eb1c64e858cce9b5e56bd99e4fcb111b /core | |
parent | 8f7a138c5cfcdfee650ba2ac7e469b85dc19c556 (diff) | |
download | nextcloud-server-0d938cc90ed6ed9c42e15ea1198e0ed813db50cd.tar.gz nextcloud-server-0d938cc90ed6ed9c42e15ea1198e0ed813db50cd.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')
-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 85e81a5a2c5..76fc921c821 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"> @@ -200,6 +200,7 @@ export default { contacts: [], debouncedFind: debounce(this.find, 300), showDateRangeModal: false, + internalIsVisible: false, } }, @@ -224,12 +225,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) => { @@ -519,7 +525,7 @@ export default { this.$refs.searchInput.$el.children[0].children[0].focus() }, closeModal() { - this.$refs.globalSearchModal.close() + this.internalIsVisible = false this.searchQuery = '' }, supportFiltering() { |