From e36a9c78e397e1731229b5b52dad559f92c9fc70 Mon Sep 17 00:00:00 2001 From: Henrik Giesel Date: Mon, 1 Mar 2021 12:28:45 +0100 Subject: [PATCH] Fix focus handling when coming from top left buttons --- ts/editor/focusHandlers.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ts/editor/focusHandlers.ts b/ts/editor/focusHandlers.ts index fde2ca7cc..b6cfb5c7f 100644 --- a/ts/editor/focusHandlers.ts +++ b/ts/editor/focusHandlers.ts @@ -1,7 +1,7 @@ /* Copyright: Ankitects Pty Ltd and contributors * License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html */ -import type { EditingArea } from "."; +import { EditingArea } from "."; import { bridgeCommand } from "./lib"; import { enableButtons, disableButtons } from "./toolbar"; @@ -30,7 +30,10 @@ export function onFocus(evt: FocusEvent): void { const currentField = evt.currentTarget as EditingArea; const previousFocus = evt.relatedTarget as EditingArea; - if (previousFocus === previousActiveElement || !previousFocus) { + if ( + previousFocus === previousActiveElement || + !(previousFocus instanceof EditingArea) + ) { focusField(currentField); } }