Merge pull request #16940 from calixteman/get_back_focus_when_required
[Editor] Only get back the focus when it has been lost after an editor has been moved in the DOM
This commit is contained in:
commit
953f271425
@ -398,14 +398,18 @@ class AnnotationEditorLayer {
|
|||||||
// re-enable them when the editor has the focus.
|
// re-enable them when the editor has the focus.
|
||||||
editor._focusEventsAllowed = false;
|
editor._focusEventsAllowed = false;
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
editor.div.addEventListener(
|
if (!editor.div.contains(document.activeElement)) {
|
||||||
"focusin",
|
editor.div.addEventListener(
|
||||||
() => {
|
"focusin",
|
||||||
editor._focusEventsAllowed = true;
|
() => {
|
||||||
},
|
editor._focusEventsAllowed = true;
|
||||||
{ once: true }
|
},
|
||||||
);
|
{ once: true }
|
||||||
activeElement.focus();
|
);
|
||||||
|
activeElement.focus();
|
||||||
|
} else {
|
||||||
|
editor._focusEventsAllowed = true;
|
||||||
|
}
|
||||||
}, 0);
|
}, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user