From 55546c7dda70366bfe8e13701a66b735a9a329e7 Mon Sep 17 00:00:00 2001 From: Dorra Jaouad Date: Thu, 16 Jan 2025 19:45:49 +0100 Subject: [PATCH 1/2] fix(SearchMessagesTab): add items navigation Signed-off-by: Dorra Jaouad --- .../SearchMessages/SearchMessagesTab.vue | 9 +++- src/types/index.ts | 44 +++++++++---------- 2 files changed, 29 insertions(+), 24 deletions(-) diff --git a/src/components/RightSidebar/SearchMessages/SearchMessagesTab.vue b/src/components/RightSidebar/SearchMessages/SearchMessagesTab.vue index 0ab211ae0e2..7856420f334 100644 --- a/src/components/RightSidebar/SearchMessages/SearchMessagesTab.vue +++ b/src/components/RightSidebar/SearchMessages/SearchMessagesTab.vue @@ -29,6 +29,7 @@ import AvatarWrapper from '../../AvatarWrapper/AvatarWrapper.vue' import SearchBox from '../../UIShared/SearchBox.vue' import TransitionWrapper from '../../UIShared/TransitionWrapper.vue' +import { useArrowNavigation } from '../../../composables/useArrowNavigation.js' import { useIsInCall } from '../../../composables/useIsInCall.js' import { useStore } from '../../../composables/useStore.js' import { ATTENDEE } from '../../../constants.ts' @@ -50,7 +51,9 @@ const emit = defineEmits<{ (event: 'close'): void }>() +const searchMessagesTab = ref(null) const searchBox = ref | null>(null) +const { initializeNavigation, resetNavigation } = useArrowNavigation(searchMessagesTab, searchBox) const isFocused = ref(false) const searchResults = ref<(CoreUnifiedSearchResultEntry & { @@ -173,8 +176,9 @@ async function fetchSearchResults(isNew = true): Promise { isFetchingResults.value = true try { - // cancel the previous search request + // cancel the previous search request and reset the navigation cancelSearchFn() + resetNavigation() const { request, cancel } = CancelableRequest(searchMessages) as SearchMessageCancelableRequest cancelSearchFn = cancel @@ -229,6 +233,7 @@ async function fetchSearchResults(isNew = true): Promise { } }) ) + nextTick(() => initializeNavigation()) } } catch (exception) { if (CancelableRequest.isCancel(exception)) { @@ -245,7 +250,7 @@ const debounceFetchSearchResults = debounce(fetchNewSearchResult, 250)