Skip to content

Commit 3c3b4a3

Browse files
Ovgoddlebaudantoine
authored andcommitted
✨(frontend) support additional shortcuts to broaden accessibility
Add support for additional shortcuts to broaden accessibility and integration capabilities. Some of these are required to ensure full functionality with the RENATER SIP media gateway, allowing shortcut mapping to DTMF signals. Others improve usability for keyboard-only users; a lightweight helper will be introduced to surface available shortcuts and make them easier to discover and use.
1 parent 9b033c5 commit 3c3b4a3

File tree

4 files changed

+60
-4
lines changed

4 files changed

+60
-4
lines changed

src/frontend/src/features/rooms/livekit/components/controls/ChatToggle.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { ToggleButton } from '@/primitives'
66
import { chatStore } from '@/stores/chat'
77
import { useSidePanel } from '../../hooks/useSidePanel'
88
import { ToggleButtonProps } from '@/primitives/ToggleButton'
9+
import { useRegisterKeyboardShortcut } from '@/features/shortcuts/useRegisterKeyboardShortcut'
910

1011
export const ChatToggle = ({
1112
onPress,
@@ -18,6 +19,11 @@ export const ChatToggle = ({
1819
const { isChatOpen, toggleChat } = useSidePanel()
1920
const tooltipLabel = isChatOpen ? 'open' : 'closed'
2021

22+
useRegisterKeyboardShortcut({
23+
id: 'toggle-chat',
24+
handler: toggleChat,
25+
})
26+
2127
return (
2228
<div
2329
className={css({

src/frontend/src/features/rooms/livekit/components/controls/HandToggle.tsx

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import {
99
closeLowerHandToasts,
1010
showLowerHandToast,
1111
} from '@/features/notifications/utils'
12+
import { useRegisterKeyboardShortcut } from '@/features/shortcuts/useRegisterKeyboardShortcut'
1213

1314
const SPEAKING_DETECTION_DELAY = 3000
1415

@@ -33,6 +34,16 @@ export const HandToggle = () => {
3334
closeLowerHandToasts()
3435
}, [isHandRaised])
3536

37+
const handleToggle = () => {
38+
toggleRaisedHand()
39+
resetToastState()
40+
}
41+
42+
useRegisterKeyboardShortcut({
43+
id: 'raise-hand',
44+
handler: handleToggle,
45+
})
46+
3647
useEffect(() => {
3748
const shouldShowToast = isSpeaking && isHandRaised && !hasShownToast
3849

@@ -68,10 +79,7 @@ export const HandToggle = () => {
6879
aria-label={t(tooltipLabel)}
6980
tooltip={t(tooltipLabel)}
7081
isSelected={isHandRaised}
71-
onPress={() => {
72-
toggleRaisedHand()
73-
resetToastState()
74-
}}
82+
onPress={handleToggle}
7583
data-attr={`controls-hand-${tooltipLabel}`}
7684
>
7785
<RiHand />

src/frontend/src/features/rooms/livekit/components/controls/ReactionsToggle.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
ReactionPortals,
1212
} from '@/features/rooms/livekit/components/ReactionPortal'
1313
import { getEmojiLabel } from '@/features/rooms/livekit/utils/reactionUtils'
14+
import { useRegisterKeyboardShortcut } from '@/features/shortcuts/useRegisterKeyboardShortcut'
1415
import { Toolbar as RACToolbar } from 'react-aria-components'
1516
import { Participant } from 'livekit-client'
1617
import useRateLimiter from '@/hooks/useRateLimiter'
@@ -41,6 +42,11 @@ export const ReactionsToggle = () => {
4142

4243
const [isVisible, setIsVisible] = useState(false)
4344

45+
useRegisterKeyboardShortcut({
46+
id: 'reaction',
47+
handler: () => setIsVisible((prev) => !prev),
48+
})
49+
4450
const sendReaction = async (emoji: string) => {
4551
const encoder = new TextEncoder()
4652
const payload: NotificationPayload = {

src/frontend/src/features/shortcuts/catalog.ts

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ export type ShortcutId =
99
| 'toggle-microphone'
1010
| 'toggle-camera'
1111
| 'push-to-talk'
12+
| 'toggle-chat'
13+
| 'toggle-participants'
14+
| 'raise-hand'
15+
| 'recording'
16+
| 'reaction'
17+
| 'fullscreen'
1218

1319
export const getShortcutDescriptorById = (id: ShortcutId) =>
1420
shortcutCatalog.find((item) => item.id === id)
@@ -44,4 +50,34 @@ export const shortcutCatalog: ShortcutDescriptor[] = [
4450
kind: 'longPress',
4551
code: 'KeyV',
4652
},
53+
{
54+
id: 'reaction',
55+
category: 'interaction',
56+
shortcut: { key: 'E', ctrlKey: true, shiftKey: true },
57+
},
58+
{
59+
id: 'fullscreen',
60+
category: 'interaction',
61+
shortcut: { key: 'F', ctrlKey: true, shiftKey: true },
62+
},
63+
{
64+
id: 'recording',
65+
category: 'interaction',
66+
shortcut: { key: 'L', ctrlKey: true, shiftKey: true },
67+
},
68+
{
69+
id: 'raise-hand',
70+
category: 'interaction',
71+
shortcut: { key: 'H', ctrlKey: true, shiftKey: true },
72+
},
73+
{
74+
id: 'toggle-chat',
75+
category: 'interaction',
76+
shortcut: { key: 'M', ctrlKey: true, shiftKey: true },
77+
},
78+
{
79+
id: 'toggle-participants',
80+
category: 'interaction',
81+
shortcut: { key: 'P', ctrlKey: true, shiftKey: true },
82+
},
4783
]

0 commit comments

Comments
 (0)