From 960f92b829dde3c95fe02b6e13ae935a5c7e16e6 Mon Sep 17 00:00:00 2001 From: Chris Wanstrath Date: Sun, 28 Sep 2025 16:32:00 -0700 Subject: [PATCH] don't worry about links --- app/src/js/focus.ts | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/app/src/js/focus.ts b/app/src/js/focus.ts index c8f444f..e4a6833 100644 --- a/app/src/js/focus.ts +++ b/app/src/js/focus.ts @@ -23,18 +23,12 @@ export function focusHandler(e: MouseEvent) { return } - // let them click on links - const a = target.closest("a") + if (["INPUT", "TEXTAREA", "CANVAS", "A"].includes(target.tagName)) + return false - if (!a) { - if (target.tagName === "INPUT" || target.tagName === "TEXTAREA" || target.tagName === "CANVAS") - return false + const selection = window.getSelection() || "" + if (selection.toString() === "") + focusInput() - const selection = window.getSelection() || "" - if (selection.toString() === "") - focusInput() - - e.preventDefault() - return true - } + e.preventDefault() }