From c2c06a99be578f5995a6e5fa3131e2b0358191fe Mon Sep 17 00:00:00 2001 From: 4gray Date: Sun, 14 Dec 2025 16:29:41 +0100 Subject: [PATCH] fix(video-player): ignore hotkeys when typing in search input Prevent global hotkeys from triggering while the user is typing in input or textarea fields. Add a private isTypingInInput(event) helper and short-circuit key handlers (info key and digit keys) to return early when the event target is an input or textarea. This avoids interfering with normal text entry (e.g., entering numbers in forms) and prevents accidental overlay toggles or channel changes while the user is focused on a form field. --- .../video-player/video-player.component.ts | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/apps/web/src/app/home/video-player/video-player.component.ts b/apps/web/src/app/home/video-player/video-player.component.ts index 5ce337d7e..a7327012f 100644 --- a/apps/web/src/app/home/video-player/video-player.component.ts +++ b/apps/web/src/app/home/video-player/video-player.component.ts @@ -368,6 +368,10 @@ export class VideoPlayerComponent implements OnInit { */ @HostListener('document:keydown.i', ['$event']) handleInfoKeyPress(event: Event): void { + // Don't trigger hotkeys when user is typing in input fields + if (this.isTypingInInput(event)) { + return; + } // Prevent default behavior and show info overlay event.preventDefault(); this.toggleInfoOverlay(); @@ -380,6 +384,10 @@ export class VideoPlayerComponent implements OnInit { handleKeyPress(event: KeyboardEvent): void { // Only handle digit keys (0-9) if (event.key >= '0' && event.key <= '9') { + // Don't trigger hotkeys when user is typing in input fields + if (this.isTypingInInput(event)) { + return; + } event.preventDefault(); this.handleChannelNumberInput(event.key); } @@ -453,4 +461,17 @@ export class VideoPlayerComponent implements OnInit { this.channelNumberTimeout = undefined; } } + + /** + * Check if the user is currently typing in an input or textarea field + * @param event Keyboard event + * @returns true if the event target is an input or textarea element + */ + private isTypingInInput(event: Event): boolean { + const target = event.target; + return ( + target instanceof HTMLInputElement || + target instanceof HTMLTextAreaElement + ); + } }