@@ -154,21 +154,28 @@ const Message = React.memo<
154
154
)
155
155
} )
156
156
157
- export const PlaceholderChatListItem = React . memo ( _ => {
158
- return < div className = { classNames ( 'chat-list-item' , 'skeleton' ) } />
159
- } )
157
+ export const PlaceholderChatListItem = React . memo (
158
+ ( props : React . HTMLAttributes < HTMLDivElement > ) => {
159
+ return (
160
+ < div { ...props } className = { classNames ( 'chat-list-item' , 'skeleton' ) } />
161
+ )
162
+ }
163
+ )
160
164
161
165
function ChatListItemArchiveLink ( {
162
166
onClick,
163
167
onFocus,
164
168
chatListItem,
169
+ ...rest
165
170
} : {
166
171
onClick : ( event : React . MouseEvent ) => void
167
172
onFocus ?: ( event : React . FocusEvent ) => void
168
173
chatListItem : Type . ChatListItemFetchResult & {
169
174
kind : 'ArchiveLink'
170
175
}
171
- } ) {
176
+ } & Required <
177
+ Pick < React . HTMLAttributes < HTMLDivElement > , 'aria-setsize' | 'aria-posinset' >
178
+ > ) {
172
179
const tx = window . static_translate
173
180
const { onContextMenu, isContextMenuActive } = useContextMenuWithActiveState ( [
174
181
{
@@ -194,6 +201,7 @@ function ChatListItemArchiveLink({
194
201
return (
195
202
< button
196
203
ref = { ref }
204
+ { ...rest }
197
205
tabIndex = { tabIndex }
198
206
onClick = { onClick }
199
207
onKeyDown = { tabindexOnKeydown }
@@ -225,6 +233,7 @@ function ChatListItemError({
225
233
onFocus,
226
234
isSelected,
227
235
onContextMenu,
236
+ ...rest
228
237
} : {
229
238
chatListItem : Type . ChatListItemFetchResult & {
230
239
kind : 'Error'
@@ -236,7 +245,9 @@ function ChatListItemError({
236
245
) => void
237
246
roleTab ?: boolean
238
247
isSelected ?: boolean
239
- } ) {
248
+ } & Required <
249
+ Pick < React . HTMLAttributes < HTMLDivElement > , 'aria-setsize' | 'aria-posinset' >
250
+ > ) {
240
251
log . info ( 'Error Loading Chatlistitem ' + chatListItem . id , chatListItem . error )
241
252
242
253
const ref = useRef < HTMLButtonElement > ( null )
@@ -251,6 +262,7 @@ function ChatListItemError({
251
262
return (
252
263
< button
253
264
ref = { ref }
265
+ { ...rest }
254
266
tabIndex = { tabIndex }
255
267
onClick = { onClick }
256
268
onKeyDown = { tabindexOnKeydown }
@@ -298,6 +310,7 @@ function ChatListItemNormal({
298
310
roleTab,
299
311
onContextMenu,
300
312
isContextMenuActive,
313
+ ...rest
301
314
} : {
302
315
chatListItem : Type . ChatListItemFetchResult & {
303
316
kind : 'ChatListItem'
@@ -310,7 +323,9 @@ function ChatListItemNormal({
310
323
isContextMenuActive ?: boolean
311
324
roleTab ?: boolean
312
325
isSelected ?: boolean
313
- } ) {
326
+ } & Required <
327
+ Pick < React . HTMLAttributes < HTMLDivElement > , 'aria-setsize' | 'aria-posinset' >
328
+ > ) {
314
329
const ref = useRef < HTMLButtonElement > ( null )
315
330
316
331
const {
@@ -330,6 +345,7 @@ function ChatListItemNormal({
330
345
return (
331
346
< button
332
347
ref = { ref }
348
+ { ...rest }
333
349
tabIndex = { tabIndex }
334
350
onClick = { onClick }
335
351
onKeyDown = { tabindexOnKeydown }
@@ -402,13 +418,21 @@ type ChatListItemProps = {
402
418
*/
403
419
roleTab ?: boolean
404
420
isSelected ?: boolean
405
- }
421
+ } & Required <
422
+ Pick < React . HTMLAttributes < HTMLDivElement > , 'aria-setsize' | 'aria-posinset' >
423
+ >
406
424
407
425
const ChatListItem = React . memo < ChatListItemProps > ( props => {
408
426
const { chatListItem } = props
409
427
410
428
// if not loaded by virtual list yet
411
- if ( typeof chatListItem === 'undefined' ) return < PlaceholderChatListItem />
429
+ if ( typeof chatListItem === 'undefined' )
430
+ return (
431
+ < PlaceholderChatListItem
432
+ aria-posinset = { props [ 'aria-posinset' ] }
433
+ aria-setsize = { props [ 'aria-setsize' ] }
434
+ />
435
+ )
412
436
413
437
if ( chatListItem . kind == 'ChatListItem' ) {
414
438
return < ChatListItemNormal { ...props } chatListItem = { chatListItem } />
@@ -420,24 +444,35 @@ const ChatListItem = React.memo<ChatListItemProps>(props => {
420
444
chatListItem = { chatListItem }
421
445
onClick = { props . onClick }
422
446
onFocus = { props . onFocus }
447
+ aria-posinset = { props [ 'aria-posinset' ] }
448
+ aria-setsize = { props [ 'aria-setsize' ] }
423
449
/>
424
450
)
425
451
} else {
426
- return < PlaceholderChatListItem />
452
+ return (
453
+ < PlaceholderChatListItem
454
+ aria-posinset = { props [ 'aria-posinset' ] }
455
+ aria-setsize = { props [ 'aria-setsize' ] }
456
+ />
457
+ )
427
458
}
428
459
} )
429
460
430
461
export default ChatListItem
431
462
432
- export const ChatListItemMessageResult = React . memo < {
433
- msr : T . MessageSearchResult
434
- onClick : ( ) => void
435
- queryStr : string
436
- /**
437
- * Whether the user is searching for messages in just a single chat.
438
- */
439
- isSingleChatSearch : boolean
440
- } > ( props => {
463
+ export const ChatListItemMessageResult = React . memo <
464
+ {
465
+ msr : T . MessageSearchResult
466
+ onClick : ( ) => void
467
+ queryStr : string
468
+ /**
469
+ * Whether the user is searching for messages in just a single chat.
470
+ */
471
+ isSingleChatSearch : boolean
472
+ } & Required <
473
+ Pick < React . HTMLAttributes < HTMLDivElement > , 'aria-setsize' | 'aria-posinset' >
474
+ >
475
+ > ( props => {
441
476
const {
442
477
msr,
443
478
onClick,
@@ -447,6 +482,7 @@ export const ChatListItemMessageResult = React.memo<{
447
482
* we don't need to specify here which chat it belongs to.
448
483
*/
449
484
isSingleChatSearch,
485
+ ...rest
450
486
} = props
451
487
452
488
const ref = useRef < HTMLButtonElement > ( null )
@@ -463,6 +499,7 @@ export const ChatListItemMessageResult = React.memo<{
463
499
return (
464
500
< button
465
501
ref = { ref }
502
+ { ...rest }
466
503
tabIndex = { tabIndex }
467
504
onClick = { onClick }
468
505
onKeyDown = { tabindexOnKeydown }
0 commit comments