mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-23 08:38:06 +02:00
[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:
parent
221ee6ca37
commit
5646604883
1 changed files with 12 additions and 8 deletions
|
@ -398,14 +398,18 @@ class AnnotationEditorLayer {
|
|||
// re-enable them when the editor has the focus.
|
||||
editor._focusEventsAllowed = false;
|
||||
setTimeout(() => {
|
||||
editor.div.addEventListener(
|
||||
"focusin",
|
||||
() => {
|
||||
editor._focusEventsAllowed = true;
|
||||
},
|
||||
{ once: true }
|
||||
);
|
||||
activeElement.focus();
|
||||
if (!editor.div.contains(document.activeElement)) {
|
||||
editor.div.addEventListener(
|
||||
"focusin",
|
||||
() => {
|
||||
editor._focusEventsAllowed = true;
|
||||
},
|
||||
{ once: true }
|
||||
);
|
||||
activeElement.focus();
|
||||
} else {
|
||||
editor._focusEventsAllowed = true;
|
||||
}
|
||||
}, 0);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue