From 39103494239c8254b1181579d4c3ea6e72a5081f Mon Sep 17 00:00:00 2001 From: Miodec Date: Mon, 12 Jun 2023 12:11:20 +0200 Subject: [PATCH] fixed dynamic keymap legends and keymap mode next not working correctly together closes #4366 --- frontend/src/ts/test/shift-tracker.ts | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/frontend/src/ts/test/shift-tracker.ts b/frontend/src/ts/test/shift-tracker.ts index 6d4a270e4..7f7bc556a 100644 --- a/frontend/src/ts/test/shift-tracker.ts +++ b/frontend/src/ts/test/shift-tracker.ts @@ -99,11 +99,16 @@ async function updateKeymapLegendCasing(): Promise { const states = getLegendStates(); if (states === undefined) return; - const keymapKeys = ( - [...document.getElementsByClassName("keymapKey")].filter( - (el) => el.className === "keymapKey" - ) - ); + const keymapKeys = [ + ...document.getElementsByClassName("keymapKey"), + ].filter((el) => { + const isKeymapKey = el.classList.contains("keymapKey"); + const isNotSpace = + !el.classList.contains("keySpace") && + !el.classList.contains("keySplitSpace"); + + return isKeymapKey && isNotSpace; + }); const layoutKeys = keymapKeys.map((el) => el.dataset["key"]); if (layoutKeys.includes(undefined)) return;