feat: add configurable ignore_keys setting to filter key events#2047
Open
tjasko wants to merge 1 commit intonovnc:masterfrom
Open
feat: add configurable ignore_keys setting to filter key events#2047tjasko wants to merge 1 commit intonovnc:masterfrom
ignore_keys setting to filter key events#2047tjasko wants to merge 1 commit intonovnc:masterfrom
Conversation
Introduce a new `ignore_keys` setting that allows users to prevent specific keyboard inputs from being forwarded to the remote VNC host while still allowing the browser/client to handle them locally. This addresses common UX issues where browser-level shortcuts (e.g. Escape to exit fullscreen or F11 for fullscreen toggle) are also sent to the VM, potentially interrupting workflows or triggering unintended actions. Key behavior: - Keys listed in `ignore_keys` are handled locally & not sent to the VM - Default value is to not ignore any key events - Supports comma-separated input with whitespace tolerance - Accepts aliases (e.g. "esc", "ctrl", "cmd") mapped to canonical codes - Matching is case-insensitive and normalized Implementation details: - Centralized supported keys via `supportedIgnoreKeys` - Added `normalizeIgnoreKey()` to map aliases to canonical codes - Introduced `wrapRfbSendKey()` to intercept and filter outgoing key events - Simplified `keyEvent()` to delegate to `rfb.sendKey` - Added validation for user input with visual feedback on invalid entries - Added dynamic tooltip and placeholder generation from supported key list UI changes: - Added `ignore_keys` input to settings panel - Added tooltip with supported key examples - Added inline validation styling for invalid entries Tests: - Added coverage for `shouldIgnoreKey()` including aliases, normalization, whitespace handling, and edge cases - Added tests for wrapped `sendKey` behavior to ensure filtering works - Updated `keyEvent()` tests to reflect pass-through behavior - Added validation and helper function tests This change improves usability when interacting with fullscreen mode and other browser-level shortcuts, while remaining backward compatible.
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.
Overview
Introduce a new
ignore_keyssetting that allows users to prevent specific keyboard inputs from being forwarded to the remote VNC host while still allowing the browser/client to handle them locally.This addresses common UX issues where browser-level shortcuts (e.g. Escape to exit fullscreen or F11 for fullscreen toggle) are also sent to the VM, potentially interrupting workflows or triggering unintended actions.
Key behavior:
ignore_keysare handled locally & not sent to the VMImplementation details:
supportedIgnoreKeysnormalizeIgnoreKey()to map aliases to canonical codeswrapRfbSendKey()to intercept and filter outgoing key eventskeyEvent()to delegate torfb.sendKeyUI changes:
ignore_keysinput to settings panelTests:
shouldIgnoreKey()including aliases, normalization, whitespace handling, and edge casessendKeybehavior to ensure filtering workskeyEvent()tests to reflect pass-through behaviorThis change improves usability when interacting with fullscreen mode and other browser-level shortcuts, while remaining backward compatible.