From 4d644cd00e2c28f84f34dde90f8f9c72355d0ef6 Mon Sep 17 00:00:00 2001 From: Eberhard Beilharz Date: Mon, 15 Dec 2025 15:44:42 +0100 Subject: [PATCH] Apply suggestions from code review Co-authored-by: Marc Durdin --- web/src/engine/src/main/headless/inputProcessor.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/web/src/engine/src/main/headless/inputProcessor.ts b/web/src/engine/src/main/headless/inputProcessor.ts index f8bc1725ba..88168a54f4 100644 --- a/web/src/engine/src/main/headless/inputProcessor.ts +++ b/web/src/engine/src/main/headless/inputProcessor.ts @@ -172,7 +172,11 @@ export class InputProcessor { // The default OSK layout for desktop devices does not include nextlayer info, relying on // modifier detection here. // It's the OSK equivalent to doModifierPress on 'desktop' form factors. - if ((formFactor == DeviceSpec.FormFactor.Desktop || !this.activeKeyboard || (this.activeKeyboard instanceof JSKeyboard && this.activeKeyboard.usesDesktopLayoutOnDevice(keyEvent.device))) && keyEvent.isSynthetic) { + if ((formFactor == DeviceSpec.FormFactor.Desktop || !this.activeKeyboard || + (this.activeKeyboard instanceof JSKeyboard && + this.activeKeyboard.usesDesktopLayoutOnDevice(keyEvent.device))) && + keyEvent.isSynthetic + ) { // If it's a desktop OSK style and this triggers a layer change, // a modifier key was clicked. No output expected, so it's safe to instantly exit. if (this.keyboardProcessor.selectLayer(keyEvent)) { @@ -182,7 +186,8 @@ export class InputProcessor { // Will handle keystroke-based non-layer change modifier & state keys, mapping them through // the physical keyboard's version of state management. `doModifierPress` must always run. - if (this.keyboardProcessor.doModifierPress(keyEvent, textStore, !keyEvent.isSynthetic) && !keyEvent.isSynthetic) { + const wasModifierPress = this.keyboardProcessor.doModifierPress(keyEvent, textStore, !keyEvent.isSynthetic); + if (wasModifierPress && !keyEvent.isSynthetic) { // If run on a desktop platform, we know that modifier & state key presses may not // produce output, so we may make an immediate return safely. return new ProcessorAction();