Skip to content

feat: add configurable ignore_keys setting to filter key events#2047

Open
tjasko wants to merge 1 commit intonovnc:masterfrom
tjasko:feat/ignore-keyboard-keys
Open

feat: add configurable ignore_keys setting to filter key events#2047
tjasko wants to merge 1 commit intonovnc:masterfrom
tjasko:feat/ignore-keyboard-keys

Conversation

@tjasko
Copy link
Copy Markdown

@tjasko tjasko commented Mar 28, 2026

Overview

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.

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.
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.

1 participant