fix: pass non-navigation keys through

This commit is contained in:
edde746
2026-02-11 18:03:11 +01:00
parent c651fe08f4
commit ee54259e4b
3 changed files with 14 additions and 4 deletions
+5
View File
@@ -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;
+3 -2
View File
@@ -76,8 +76,9 @@ class _InputModeTrackerState extends State<InputModeTracker> {
// 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
@@ -1484,8 +1484,10 @@ class _PlexVideoControlsState extends State<PlexVideoControls> 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<PlexVideoControls> 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(