Skip to content

feat: comprehensive keyboard shortcuts for roundtable (T/V/Esc/Space/M/S/C)#256

Merged
wyuc merged 1 commit intoTHU-MAIC:mainfrom
YizukiAme:feat/keyboard-shortcuts
Mar 25, 2026
Merged

feat: comprehensive keyboard shortcuts for roundtable (T/V/Esc/Space/M/S/C)#256
wyuc merged 1 commit intoTHU-MAIC:mainfrom
YizukiAme:feat/keyboard-shortcuts

Conversation

@YizukiAme
Copy link
Contributor

@YizukiAme YizukiAme commented Mar 24, 2026

Summary

Adds comprehensive keyboard shortcuts for the roundtable to improve interaction speed, especially during live discussions where clicking small UI elements is inconvenient.

Closes #255

Shortcuts

Core (roundtable/index.tsx)

Key Action Guard
T Toggle text input box Disabled when typing in input/textarea
V Toggle voice input Disabled when typing; gated on asrEnabled; busyRef prevents rapid-fire
Escape Dismiss open input/voice panels Works even when input is focused; Keyboard Lock prevents fullscreen exit

Stage-level (stage.tsx)

Key Action Guard
Space Play/pause lecture Extended to work outside presentation mode
Escape Exit fullscreen Only when no panels are open
M Toggle TTS mute All modes
S Toggle sidebar Non-fullscreen only
C Toggle chat panel Non-fullscreen only

Changes

components/roundtable/index.tsx

  • Extended existing Space-only keydown handler into unified shortcut handler
  • Added ThandleToggleInput(), VhandleToggleVoice()
  • Escape handled separately (before input guard) so it works while typing
  • Moved useEffect after useAudioRecorder / handleToggleVoice declarations

components/stage.tsx

  • Space for lecture play/pause now works outside presentation mode
  • Escape handling: Keyboard Lock API (navigator.keyboard.lock(['Escape'])) prevents browser from auto-exiting fullscreen; our handler decides: panels open → roundtable closes them, no panels → exit fullscreen
  • Added M/S/C shortcuts with appropriate fullscreen guards

lib/hooks/use-audio-recorder.ts

  • Added busyRef synchronous lock to prevent rapid V press from creating duplicate SpeechRecognition instances
  • Silenced non-fatal aborted error in onerror handler

Testing

  • T → opens text input. T again → closes. Typing in input: T types normally
  • V → starts voice recording. V again → stops. Rapid V press: no error
  • Escape → closes any open panel (works from within text input too)
  • Escape in fullscreen with panels open → closes panels only (no fullscreen exit)
  • Escape in fullscreen with no panels → exits fullscreen
  • Space → play/pause lecture from normal view (not just presentation)
  • M → toggles TTS mute
  • S → toggles sidebar (non-fullscreen)
  • C → toggles chat panel (non-fullscreen)

🤖 AI-assisted and reviewed by Claude Opus 4.6

@YizukiAme YizukiAme marked this pull request as draft March 24, 2026 17:48
@YizukiAme YizukiAme force-pushed the feat/keyboard-shortcuts branch 5 times, most recently from 50f4896 to 00287d9 Compare March 24, 2026 18:20
@YizukiAme YizukiAme changed the title feat: keyboard shortcuts for roundtable (T/V/Escape/Space) feat: comprehensive keyboard shortcuts for roundtable (T/V/Esc/Space/M/S/C) Mar 24, 2026
@YizukiAme YizukiAme force-pushed the feat/keyboard-shortcuts branch 3 times, most recently from 870ee02 to 05c0380 Compare March 24, 2026 18:39
@YizukiAme YizukiAme marked this pull request as ready for review March 24, 2026 18:40
@YizukiAme YizukiAme force-pushed the feat/keyboard-shortcuts branch from 05c0380 to 36ff5fd Compare March 25, 2026 03:54
roundtable/index.tsx:
- T: toggle text input box (calls handleToggleInput)
- V: toggle voice input (calls handleToggleVoice, gated on asrEnabled)
- Escape: dismiss open input/voice panels + cancel recording
- Space: discussion pause/resume (existing, now part of unified handler)
- All shortcuts guarded against input/textarea/contentEditable focus

stage.tsx:
- Space (lecture play/pause) now works outside presentation mode
- Arrow keys remain presentation-only to avoid scroll interference

Closes THU-MAIC#255
@YizukiAme YizukiAme force-pushed the feat/keyboard-shortcuts branch from 36ff5fd to 07af7ff Compare March 25, 2026 04:39
@YizukiAme
Copy link
Contributor Author

Small addition not reflected in the description:

  • Added ArrowUp / ArrowDown shortcuts for volume control

Will update the PR description if needed.

Copy link
Contributor

@wyuc wyuc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested locally. Approved

@wyuc wyuc merged commit e3bdc47 into THU-MAIC:main Mar 25, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: comprehensive keyboard shortcuts for roundtable (T/V/Space/Esc)

2 participants