From 1462d5193b3dbb53cd75350f665b5c6e0874b62e Mon Sep 17 00:00:00 2001 From: Miodec Date: Thu, 11 Jul 2024 10:50:48 +0200 Subject: [PATCH] fix: zen mode not working --- frontend/src/ts/test/caret.ts | 8 ++++---- frontend/src/ts/test/test-ui.ts | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/frontend/src/ts/test/caret.ts b/frontend/src/ts/test/caret.ts index 1840f6209..7ac07e08f 100644 --- a/frontend/src/ts/test/caret.ts +++ b/frontend/src/ts/test/caret.ts @@ -116,8 +116,8 @@ export async function updatePosition(noAnim = false): Promise { ); const letterPosTop = - currentLetter?.offsetTop || - previousLetter?.offsetTop || + currentLetter?.offsetTop ?? + previousLetter?.offsetTop ?? lastWordLetter?.offsetTop; const letterHeight = @@ -127,8 +127,8 @@ export async function updatePosition(noAnim = false): Promise { Config.fontSize * Numbers.convertRemToPixels(1); const letterWidth = - currentLetter?.offsetWidth || - previousLetter?.offsetWidth || + currentLetter?.offsetWidth ?? + previousLetter?.offsetWidth ?? lastWordLetter?.offsetWidth; const diff = letterHeight - caret.offsetHeight; diff --git a/frontend/src/ts/test/test-ui.ts b/frontend/src/ts/test/test-ui.ts index 9d799d791..b7c8bfe3d 100644 --- a/frontend/src/ts/test/test-ui.ts +++ b/frontend/src/ts/test/test-ui.ts @@ -242,7 +242,7 @@ export function updateActiveElement( } if (Config.mode === "zen" && backspace) { active?.remove(); - } else if (active !== null) { + } else if (active !== null && !initial) { active.classList.remove("active"); } const activeWord =