From 0d0442b3627d9e3d298a39291ab239f6fe318fc9 Mon Sep 17 00:00:00 2001 From: Gyrcas Date: Sat, 26 Sep 2026 16:03:51 -0400 Subject: [PATCH 1/2] Implementing fix to prevent TypeBox box from gaining focus when switching back to a channel. If the box textContent is empty and it was not caused by a backspace, it will remove focus --- src/webpage/markdown.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/webpage/markdown.ts b/src/webpage/markdown.ts index 9c31885..80cde6f 100644 --- a/src/webpage/markdown.ts +++ b/src/webpage/markdown.ts @@ -1460,7 +1460,7 @@ function saveCaretPosition( len = Math.min(len, txtLengthFunc(context).length); len += offset; - return function restore(_backspace = false) { + return function restore(backspace = false) { if (!selection) return; const pos = getTextNodeAtPosition(context, len, txtLengthFunc); if ( @@ -1480,6 +1480,10 @@ function saveCaretPosition( const range = new Range(); range.setStart(pos.node, pos.position); selection.addRange(range); + + if(!backspace && !TypeBox.box.textContent){ + TypeBox.box.blur(); + } }; } catch { return undefined; From 7b47bb2d06ef845af04c7a33bec6ac4fee4d53ad Mon Sep 17 00:00:00 2001 From: Gyrcas Date: Sat, 26 Sep 2026 16:27:32 -0400 Subject: [PATCH 2/2] Adding mobile boolean from utils to markdown.ts to only blur TypeBox box if it is a mobile device --- src/webpage/markdown.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/webpage/markdown.ts b/src/webpage/markdown.ts index 80cde6f..2926ee3 100644 --- a/src/webpage/markdown.ts +++ b/src/webpage/markdown.ts @@ -7,6 +7,8 @@ import {Dialog} from "./settings.js"; import {Contextmenu} from "./contextmenu.js"; import {highlight} from "./highlighter/index.js"; import {TypeBox} from "./typeBox.js"; +import {mobile} from "./utils/utils"; + const linkMenu = new Contextmenu("copyLink", true); linkMenu.addButton( () => I18n.copyRegLink(), @@ -1481,7 +1483,7 @@ function saveCaretPosition( range.setStart(pos.node, pos.position); selection.addRange(range); - if(!backspace && !TypeBox.box.textContent){ + if(mobile && !backspace && !TypeBox.box.textContent){ TypeBox.box.blur(); } };