From 4f80fd1d3f1a5cf5945fee7a870df7595c17d7a4 Mon Sep 17 00:00:00 2001 From: Ayush Amawate Date: Tue, 24 Mar 2026 08:56:29 +0530 Subject: [PATCH] aplly fixes to the new file --- frontend/src/utility-functions/input.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/frontend/src/utility-functions/input.ts b/frontend/src/utility-functions/input.ts index dd0b129cad..9d472886d4 100644 --- a/frontend/src/utility-functions/input.ts +++ b/frontend/src/utility-functions/input.ts @@ -344,7 +344,15 @@ function detectShake(e: PointerEvent | MouseEvent): boolean { } function targetIsTextField(target: EventTarget | HTMLElement | undefined): boolean { - return target instanceof HTMLElement && (target.nodeName === "INPUT" || target.nodeName === "TEXTAREA" || target.isContentEditable); + if (!(target instanceof HTMLElement)) return false; + if (target.nodeName === "TEXTAREA" || target.isContentEditable) return true; + if (target instanceof HTMLInputElement) { + const inputType = target.type.toLowerCase(); + // Only consider actual text-entry input types as text fields, not checkboxes, radio buttons, etc. + const textInputTypes = ["text", "password", "email", "number", "search", "tel", "url", "date", "datetime-local", "month", "time", "week"]; + return textInputTypes.includes(inputType); + } + return false; } function potentiallyRestoreCanvasFocus(e: Event) {