From ee54259e4be2b873558c27c9b67a8b2d6b1fc7ee Mon Sep 17 00:00:00 2001 From: edde746 <86283021+edde746@users.noreply.github.com> Date: Wed, 11 Feb 2026 18:02:51 +0100 Subject: [PATCH] fix: pass non-navigation keys through --- lib/focus/dpad_navigator.dart | 5 +++++ lib/focus/input_mode_tracker.dart | 5 +++-- lib/widgets/video_controls/video_controls.dart | 8 ++++++-- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/lib/focus/dpad_navigator.dart b/lib/focus/dpad_navigator.dart index 0148e672..0cdc1544 100644 --- a/lib/focus/dpad_navigator.dart +++ b/lib/focus/dpad_navigator.dart @@ -45,6 +45,11 @@ extension DpadKeyExtension on LogicalKeyboardKey { /// Whether this key is a context menu key. bool get isContextMenuKey => _contextMenuKeys.contains(this); + /// Whether this key is a navigation key (dpad, select, back, context menu, tab). + /// Use this to distinguish navigation keys from typing/volume/media keys. + bool get isNavigationKey => + isDpadDirection || isSelectKey || isBackKey || isContextMenuKey || this == LogicalKeyboardKey.tab; + /// Whether this key moves focus left. bool get isLeftKey => this == LogicalKeyboardKey.arrowLeft; diff --git a/lib/focus/input_mode_tracker.dart b/lib/focus/input_mode_tracker.dart index 0d317a3a..c1752ae9 100644 --- a/lib/focus/input_mode_tracker.dart +++ b/lib/focus/input_mode_tracker.dart @@ -76,8 +76,9 @@ class _InputModeTrackerState extends State { // events after route pops (see BackKeySuppressorObserver). BackKeyPressTracker.handleKeyEvent(event); - // Only switch to keyboard mode on key down (not repeats or releases) - if (event is KeyDownEvent) { + // Only switch to keyboard mode on navigation key down (not repeats, releases, + // or non-navigation keys like volume buttons or letter keys while typing) + if (event is KeyDownEvent && event.logicalKey.isNavigationKey) { _setMode(InputMode.keyboard); } // Return false to let the event continue propagating diff --git a/lib/widgets/video_controls/video_controls.dart b/lib/widgets/video_controls/video_controls.dart index 300c95ce..1d1c87ec 100644 --- a/lib/widgets/video_controls/video_controls.dart +++ b/lib/widgets/video_controls/video_controls.dart @@ -1484,8 +1484,10 @@ class _PlexVideoControlsState extends State with WindowListen } // Only handle KeyDown and KeyRepeat events - // Consume KeyUp events to prevent them leaking to previous routes + // Consume KeyUp events for navigation keys to prevent leaking to previous routes + // Let non-navigation keys (volume, etc.) pass through to the OS if (!event.isActionable) { + if (!event.logicalKey.isNavigationKey) return KeyEventResult.ignored; return KeyEventResult.handled; } @@ -1572,7 +1574,9 @@ class _PlexVideoControlsState extends State with WindowListen onToggleShader: _toggleShader, onSkipMarker: _performAutoSkip, ); - // Never return .ignored from fullscreen video — prevent leaking to previous routes + // Let non-navigation keys (volume, etc.) pass through to the OS + if (!event.logicalKey.isNavigationKey) return KeyEventResult.ignored; + // Never return .ignored for navigation keys — prevent leaking to previous routes return result == KeyEventResult.ignored ? KeyEventResult.handled : result; }, child: Listener(