fix: prevent modifier-key combos (Ctrl+C, Ctrl+S) from triggering single-key shortcuts#359
Open
YizukiAme wants to merge 1 commit intoTHU-MAIC:mainfrom
Open
fix: prevent modifier-key combos (Ctrl+C, Ctrl+S) from triggering single-key shortcuts#359YizukiAme wants to merge 1 commit intoTHU-MAIC:mainfrom
YizukiAme wants to merge 1 commit intoTHU-MAIC:mainfrom
Conversation
Ctrl+C, Ctrl+S, Ctrl+M (and ⌘ equivalents on macOS) were incorrectly intercepted by the global keydown handler in Stage, toggling the chat sidebar, scene sidebar, or TTS mute instead of performing their native browser actions (copy, save, etc.). Add a modifier-key guard at the top of onKeyDown so that any key combination involving Ctrl, Meta, or Alt is passed through to the browser. Fixes THU-MAIC#358
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #358 —
Ctrl+C(copy),Ctrl+S(save), and other modifier-key combinations were incorrectly intercepted by the global keyboard shortcut handler inStage, toggling UI panels instead of performing their native browser actions.Problem
The
onKeyDownhandler incomponents/stage.tsxmatches single-letter keys (c,s,m) without checking for modifier keys. When a user pressesCtrl+C:event.key→'c'✅ matches thecase 'c'branchevent.ctrlKey→trueevent.preventDefault()blocks the native copy actionsetChatAreaCollapsed(!chatAreaCollapsed)toggles the chat sidebarCtrl+CCtrl+SCtrl+M⌘+C/⌘+S(macOS)metaKeyFix
Add a single modifier-key guard at the top of the
onKeyDownhandler:This lets all modifier-key combinations pass through to the browser while preserving bare-key shortcuts (
c,s,m, arrows, space, escape).Risk Assessment
Minimal. No existing shortcut in this handler is designed to work with
Ctrl/Meta/Alt. The guard only affects key events that were never intended to be captured.