Skip to content

Commit

Permalink
Merge pull request #1055 from hgiesel/editorfocustofix
Browse files Browse the repository at this point in the history
Do not execute caretToEnd when Alt-tabbing back to application
  • Loading branch information
dae authored Mar 6, 2021
2 parents 3ba08d1 + aa3ba38 commit 312fa27
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions ts/editor/focusHandlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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);
}
}
}

Expand Down

0 comments on commit 312fa27

Please sign in to comment.