Merge pull request #1055 from hgiesel/editorfocustofix

Do not execute caretToEnd when Alt-tabbing back to application
This commit is contained in:
Damien Elmes 2021-03-07 09:40:57 +10:00 committed by GitHub
commit 312fa27898
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -20,7 +20,6 @@ function focusField(field: EditingArea) {
field.focusEditable();
bridgeCommand(`focus:${field.ord}`);
enableButtons();
caretToEnd(field);
}
// 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;
if (
previousFocus === previousActiveElement ||
!(previousFocus instanceof EditingArea)
!(previousFocus instanceof EditingArea) ||
previousFocus === previousActiveElement
) {
focusField(currentField);
if (previousFocus) {
caretToEnd(currentField);
}
}
}