@@ -32,6 +32,8 @@ import { useUnreadThreadRooms } from "./useUnreadThreadRooms";
32
32
import { StatelessNotificationBadge } from "../../rooms/NotificationBadge/StatelessNotificationBadge" ;
33
33
import { NotificationLevel } from "../../../../stores/notifications/NotificationLevel" ;
34
34
import PosthogTrackers from "../../../../PosthogTrackers" ;
35
+ import { getKeyBindingsManager } from "../../../../KeyBindingsManager" ;
36
+ import { KeyBindingAction } from "../../../../accessibility/KeyboardShortcuts" ;
35
37
36
38
interface ThreadsActivityCentreProps {
37
39
/**
@@ -49,41 +51,56 @@ export function ThreadsActivityCentre({ displayButtonLabel }: ThreadsActivityCen
49
51
const roomsAndNotifications = useUnreadThreadRooms ( open ) ;
50
52
51
53
return (
52
- < Menu
53
- align = "end"
54
- open = { open }
55
- onOpenChange = { ( newOpen ) => {
56
- // Track only when the Threads Activity Centre is opened
57
- if ( newOpen ) PosthogTrackers . trackInteraction ( "WebThreadsActivityCentreButton" ) ;
54
+ < div
55
+ className = "mx_ThreadsActivityCentre_container"
56
+ onKeyDown = { ( evt ) => {
57
+ // Do nothing if the TAC is closed
58
+ if ( ! open ) return ;
58
59
59
- setOpen ( newOpen ) ;
60
+ const action = getKeyBindingsManager ( ) . getNavigationAction ( evt ) ;
61
+
62
+ // Block spotlight opening
63
+ if ( action === KeyBindingAction . FilterRooms ) {
64
+ evt . stopPropagation ( ) ;
65
+ }
60
66
} }
61
- side = "right"
62
- title = { _t ( "threads_activity_centre|header" ) }
63
- trigger = {
64
- < ThreadsActivityCentreButton
65
- displayLabel = { displayButtonLabel }
66
- notificationLevel = { roomsAndNotifications . greatestNotificationLevel }
67
- />
68
- }
69
67
>
70
- { /* Make the content of the pop-up scrollable */ }
71
- < div className = "mx_ThreadsActivity_rows" >
72
- { roomsAndNotifications . rooms . map ( ( { room, notificationLevel } ) => (
73
- < ThreadsActivityRow
74
- key = { room . roomId }
75
- room = { room }
76
- notificationLevel = { notificationLevel }
77
- onClick = { ( ) => setOpen ( false ) }
68
+ < Menu
69
+ align = "end"
70
+ open = { open }
71
+ onOpenChange = { ( newOpen ) => {
72
+ // Track only when the Threads Activity Centre is opened
73
+ if ( newOpen ) PosthogTrackers . trackInteraction ( "WebThreadsActivityCentreButton" ) ;
74
+
75
+ setOpen ( newOpen ) ;
76
+ } }
77
+ side = "right"
78
+ title = { _t ( "threads_activity_centre|header" ) }
79
+ trigger = {
80
+ < ThreadsActivityCentreButton
81
+ displayLabel = { displayButtonLabel }
82
+ notificationLevel = { roomsAndNotifications . greatestNotificationLevel }
78
83
/>
79
- ) ) }
80
- { roomsAndNotifications . rooms . length === 0 && (
81
- < div className = "mx_ThreadsActivityCentre_emptyCaption" >
82
- { _t ( "threads_activity_centre|no_rooms_with_unreads_threads" ) }
83
- </ div >
84
- ) }
85
- </ div >
86
- </ Menu >
84
+ }
85
+ >
86
+ { /* Make the content of the pop-up scrollable */ }
87
+ < div className = "mx_ThreadsActivity_rows" >
88
+ { roomsAndNotifications . rooms . map ( ( { room, notificationLevel } ) => (
89
+ < ThreadsActivityRow
90
+ key = { room . roomId }
91
+ room = { room }
92
+ notificationLevel = { notificationLevel }
93
+ onClick = { ( ) => setOpen ( false ) }
94
+ />
95
+ ) ) }
96
+ { roomsAndNotifications . rooms . length === 0 && (
97
+ < div className = "mx_ThreadsActivityCentre_emptyCaption" >
98
+ { _t ( "threads_activity_centre|no_rooms_with_unreads_threads" ) }
99
+ </ div >
100
+ ) }
101
+ </ div >
102
+ </ Menu >
103
+ </ div >
87
104
) ;
88
105
}
89
106
0 commit comments