Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion frontend/src/utility-functions/input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Loading