mirror of
https://github.com/ankitects/anki.git
synced 2025-09-20 23:12:21 -04:00
Do not execute caretToEnd when Alt-tabbing back to application
This commit is contained in:
parent
3ba08d1189
commit
aa3ba38392
1 changed files with 6 additions and 3 deletions
|
@ -20,7 +20,6 @@ function focusField(field: EditingArea) {
|
||||||
field.focusEditable();
|
field.focusEditable();
|
||||||
bridgeCommand(`focus:${field.ord}`);
|
bridgeCommand(`focus:${field.ord}`);
|
||||||
enableButtons();
|
enableButtons();
|
||||||
caretToEnd(field);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// For distinguishing focus by refocusing window from deliberate focus
|
// For distinguishing focus by refocusing window from deliberate focus
|
||||||
|
@ -31,10 +30,14 @@ export function onFocus(evt: FocusEvent): void {
|
||||||
const previousFocus = evt.relatedTarget as EditingArea;
|
const previousFocus = evt.relatedTarget as EditingArea;
|
||||||
|
|
||||||
if (
|
if (
|
||||||
previousFocus === previousActiveElement ||
|
!(previousFocus instanceof EditingArea) ||
|
||||||
!(previousFocus instanceof EditingArea)
|
previousFocus === previousActiveElement
|
||||||
) {
|
) {
|
||||||
focusField(currentField);
|
focusField(currentField);
|
||||||
|
|
||||||
|
if (previousFocus) {
|
||||||
|
caretToEnd(currentField);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue