From 35b100767fe7151281660930d4d34368cb42153c Mon Sep 17 00:00:00 2001 From: AK <144495202+AKnassa@users.noreply.github.com> Date: Tue, 28 Apr 2026 09:15:31 -0400 Subject: [PATCH] refactor(fullscreen): route F key through ShortcutsProvider MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit shortcuts.json already declares fullscreen -> F, but the provider was listening for KeyF on its own keydown handler in parallel — both fired on every F press, with the canonical shortcuts dispatch going nowhere. Subscribe via onShortcut('fullscreen', toggleFullscreen, ...) and drop the KeyF branch (plus the now-unused inputFocused check). Escape stays local because its action is gated on the escExitFullscreen profile setting; F11 stays local because it's shell-only and not in shortcuts.json. Co-Authored-By: Claude Opus 4.7 --- src/common/Fullscreen/FullscreenProvider.tsx | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/src/common/Fullscreen/FullscreenProvider.tsx b/src/common/Fullscreen/FullscreenProvider.tsx index 61a0f67c0..b98d64186 100644 --- a/src/common/Fullscreen/FullscreenProvider.tsx +++ b/src/common/Fullscreen/FullscreenProvider.tsx @@ -2,6 +2,7 @@ import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'; import { useServices } from 'stremio/services'; +import onShortcut from '../Shortcuts/onShortcut'; import useShell, { type WindowVisibility } from '../useShell'; import FullscreenContext, { type FullscreenContextValue } from './FullscreenContext'; @@ -56,6 +57,8 @@ const FullscreenProvider = ({ children }: Props) => { fullscreen ? exitFullscreen() : requestFullscreen(); }, [fullscreen, exitFullscreen, requestFullscreen]); + onShortcut('fullscreen', toggleFullscreen, [toggleFullscreen]); + useEffect(() => { if (!core?.active) return; @@ -102,23 +105,10 @@ const FullscreenProvider = ({ children }: Props) => { }; const onKeyDown = (event: KeyboardEvent) => { - const activeElement = document.activeElement as HTMLElement; - - const inputFocused = - activeElement && - (activeElement.tagName === 'INPUT' || - activeElement.tagName === 'TEXTAREA' || - activeElement.tagName === 'SELECT' || - activeElement.isContentEditable); - if (event.code === 'Escape' && escExitFullscreenRef.current) { exitFullscreen(); } - if (event.code === 'KeyF' && !inputFocused) { - toggleFullscreen(); - } - if (event.code === 'F11' && shell.active) { toggleFullscreen(); }