From afc990f1a8cf75d1051aef87353e83efb2da8730 Mon Sep 17 00:00:00 2001 From: Pokey Rule <755842+pokey@users.noreply.github.com> Date: Fri, 26 Apr 2024 15:38:44 +0100 Subject: [PATCH] Fix keyboard broken by #2235 This was not caught by our tests because we mock away command server. Not sure how to prevent this sort of thing in the future --- packages/cursorless-engine/src/core/getCommandFallback.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/cursorless-engine/src/core/getCommandFallback.ts b/packages/cursorless-engine/src/core/getCommandFallback.ts index d69a4b86dc5..941a02c0eb3 100644 --- a/packages/cursorless-engine/src/core/getCommandFallback.ts +++ b/packages/cursorless-engine/src/core/getCommandFallback.ts @@ -14,10 +14,9 @@ export async function getCommandFallback( runAction: (actionDescriptor: ActionDescriptor) => Promise, command: CommandComplete, ): Promise { - if ( - commandServerApi == null || - (await commandServerApi.getFocusedElementType()) === "textEditor" - ) { + const focusedElementType = await commandServerApi?.getFocusedElementType(); + + if (focusedElementType == null || focusedElementType === "textEditor") { return null; }