mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 22:12:21 -04:00
Fix focus handling when coming from top left buttons
This commit is contained in:
parent
c9992e395f
commit
e36a9c78e3
1 changed files with 5 additions and 2 deletions
|
@ -1,7 +1,7 @@
|
||||||
/* Copyright: Ankitects Pty Ltd and contributors
|
/* Copyright: Ankitects Pty Ltd and contributors
|
||||||
* License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html */
|
* 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 { bridgeCommand } from "./lib";
|
||||||
import { enableButtons, disableButtons } from "./toolbar";
|
import { enableButtons, disableButtons } from "./toolbar";
|
||||||
|
@ -30,7 +30,10 @@ export function onFocus(evt: FocusEvent): void {
|
||||||
const currentField = evt.currentTarget as EditingArea;
|
const currentField = evt.currentTarget as EditingArea;
|
||||||
const previousFocus = evt.relatedTarget as EditingArea;
|
const previousFocus = evt.relatedTarget as EditingArea;
|
||||||
|
|
||||||
if (previousFocus === previousActiveElement || !previousFocus) {
|
if (
|
||||||
|
previousFocus === previousActiveElement ||
|
||||||
|
!(previousFocus instanceof EditingArea)
|
||||||
|
) {
|
||||||
focusField(currentField);
|
focusField(currentField);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue