From b7c06d1ddc3b927f2aa65fd108820a4a50d46012 Mon Sep 17 00:00:00 2001 From: Leonabcd123 <156839416+Leonabcd123@users.noreply.github.com> Date: Tue, 16 Dec 2025 18:47:38 +0200 Subject: [PATCH] fix(blind mode): Extra letters in blind mode causing caret problems (@Leonabcd123) (#7254) ### Description - Enable blind mode - Write extra letters - Caret will jump to above the first letter in the word --- frontend/src/ts/utils/caret.ts | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/frontend/src/ts/utils/caret.ts b/frontend/src/ts/utils/caret.ts index d782ebf28..60c603c48 100644 --- a/frontend/src/ts/utils/caret.ts +++ b/frontend/src/ts/utils/caret.ts @@ -297,13 +297,16 @@ export class Caret { // we also clamp the letterIndex to be within the range of actual letters // anything beyond just goes to the edge of the word let side: "beforeLetter" | "afterLetter" = "beforeLetter"; - if ( - options.letterIndex >= letters.length || - (Config.blindMode && options.letterIndex >= wordText.length) - ) { + if (options.letterIndex >= letters.length) { side = "afterLetter"; - options.letterIndex = letters.length - 1; + + if (Config.blindMode) { + options.letterIndex = wordText?.length - 1; + } else { + options.letterIndex = letters.length - 1; + } } + if (options.letterIndex < 0) { options.letterIndex = 0; }