@@ -29,6 +29,7 @@ import AvatarWrapper from '../../AvatarWrapper/AvatarWrapper.vue'
29
29
import SearchBox from ' ../../UIShared/SearchBox.vue'
30
30
import TransitionWrapper from ' ../../UIShared/TransitionWrapper.vue'
31
31
32
+ import { useArrowNavigation } from ' ../../../composables/useArrowNavigation.js'
32
33
import { useIsInCall } from ' ../../../composables/useIsInCall.js'
33
34
import { useStore } from ' ../../../composables/useStore.js'
34
35
import { ATTENDEE } from ' ../../../constants.ts'
@@ -50,7 +51,10 @@ const emit = defineEmits<{
50
51
(event : ' close' ): void
51
52
}>()
52
53
54
+ const searchMessagesTab = ref <HTMLElement | null >(null )
53
55
const searchBox = ref <InstanceType <typeof SearchBox > | null >(null )
56
+ const { initializeNavigation, resetNavigation } = useArrowNavigation (searchMessagesTab , searchBox )
57
+
54
58
const isFocused = ref (false )
55
59
const searchResults = ref < (CoreUnifiedSearchResultEntry &
56
60
{
@@ -173,8 +177,9 @@ async function fetchSearchResults(isNew = true): Promise<void> {
173
177
isFetchingResults .value = true
174
178
175
179
try {
176
- // cancel the previous search request
180
+ // cancel the previous search request and reset the navigation
177
181
cancelSearchFn ()
182
+ resetNavigation ()
178
183
179
184
const { request, cancel } = CancelableRequest (searchMessages ) as SearchMessageCancelableRequest
180
185
cancelSearchFn = cancel
@@ -229,6 +234,7 @@ async function fetchSearchResults(isNew = true): Promise<void> {
229
234
}
230
235
})
231
236
)
237
+ nextTick (() => initializeNavigation ())
232
238
}
233
239
} catch (exception ) {
234
240
if (CancelableRequest .isCancel (exception )) {
@@ -242,18 +248,19 @@ async function fetchSearchResults(isNew = true): Promise<void> {
242
248
}
243
249
244
250
const debounceFetchSearchResults = debounce (fetchNewSearchResult , 250 )
251
+
252
+ watch ([searchText , fromUser , sinceDate , untilDate ], debounceFetchSearchResults )
245
253
</script >
246
254
247
255
<template >
248
- <div class =" search-messages-tab" >
256
+ <div ref = " searchMessagesTab " class =" search-messages-tab" >
249
257
<div class =" search-form" >
250
258
<div class =" search-form__main" >
251
259
<div class =" search-form__search-box-wrapper" >
252
260
<SearchBox ref =" searchBox"
253
261
:value.sync =" searchText"
254
262
:placeholder-text =" t('spreed', 'Search messages …')"
255
- :is-focused.sync =" isFocused"
256
- @input =" debounceFetchSearchResults" />
263
+ :is-focused.sync =" isFocused" />
257
264
<NcButton :pressed.sync =" searchDetailsOpened"
258
265
:aria-label =" t('spreed', 'Search options')"
259
266
:title =" t('spreed', 'Search options')"
@@ -271,8 +278,7 @@ const debounceFetchSearchResults = debounce(fetchNewSearchResult, 250)
271
278
:placeholder =" t('spreed', 'From User')"
272
279
user-select
273
280
:loading =" !participantsInitialised"
274
- :options =" participants"
275
- @update:modelValue =" debounceFetchSearchResults" />
281
+ :options =" participants" />
276
282
<div class =" search-form__search-detail__date-picker-wrapper" >
277
283
<NcDateTimePickerNative id =" search-form__search-detail__date-picker--since"
278
284
v-model =" sinceDate"
@@ -282,8 +288,7 @@ const debounceFetchSearchResults = debounce(fetchNewSearchResult, 250)
282
288
:step =" 1"
283
289
:max =" new Date()"
284
290
:aria-label =" t('spreed', 'Since')"
285
- :label =" t('spreed', 'Since')"
286
- @update:modelValue =" debounceFetchSearchResults" />
291
+ :label =" t('spreed', 'Since')" />
287
292
<NcDateTimePickerNative id =" search-form__search-detail__date-picker--until"
288
293
v-model =" untilDate"
289
294
class =" search-form__search-detail__date-picker"
@@ -292,8 +297,7 @@ const debounceFetchSearchResults = debounce(fetchNewSearchResult, 250)
292
297
:max =" new Date()"
293
298
:aria-label =" t('spreed', 'Until')"
294
299
:label =" t('spreed', 'Until')"
295
- :minute-step =" 1"
296
- @update:modelValue =" debounceFetchSearchResults" />
300
+ :minute-step =" 1" />
297
301
</div >
298
302
</div >
299
303
</TransitionWrapper >
0 commit comments