Skip to content

Commit 05123e8

Browse files
authored
fix: wrapper height not updated when tape is turned off mid-test (@nadalaba) (monkeytypegame#7043)
- this happens if words were removed (due to overflowing the wrapper) before turning the tape off https://github.com/user-attachments/assets/97be5efb-4a37-46b7-baa2-dd482e84a43c this is a regression introduced in monkeytypegame#6932
1 parent a0c9dec commit 05123e8

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

frontend/src/ts/test/test-ui.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -616,13 +616,15 @@ export function updateWordsWrapperHeight(force = false): void {
616616
} else {
617617
if (Config.tapeMode === "off") {
618618
//tape off, showAllLines off, non-zen mode
619+
const wordElements =
620+
document.querySelectorAll<HTMLElement>("#words .word");
619621
let lines = 0;
620622
let lastTop = 0;
621623
let wordIndex = 0;
622624
let wrapperHeight = 0;
623625

624626
while (lines < 3) {
625-
const word = getWordElement(wordIndex);
627+
const word = wordElements[wordIndex];
626628
if (!word) break;
627629
const top = word.offsetTop;
628630
if (top > lastTop) {

0 commit comments

Comments
 (0)