diff --git a/src/display/editor/freetext.js b/src/display/editor/freetext.js index 71b6be66cb0bf..7e359106d8563 100644 --- a/src/display/editor/freetext.js +++ b/src/display/editor/freetext.js @@ -252,11 +252,11 @@ class FreeTextEditor extends AnnotationEditor { this.editorDiv.removeEventListener("blur", this.#boundEditorDivBlur); this.editorDiv.removeEventListener("input", this.#boundEditorDivInput); - if (this.pageIndex === this._uiManager.currentPageIndex) { - // On Chrome, the focus is given to when contentEditable is set to - // false, hence we focus the div. - this.div.focus(); - } + // On Chrome, the focus is given to when contentEditable is set to + // false, hence we focus the div. + this.div.focus({ + preventScroll: true /* See issue #15744 */, + }); // In case the blur callback hasn't been called. this.isEditing = false; diff --git a/src/display/editor/ink.js b/src/display/editor/ink.js index 429c443623734..6ef2b8e980304 100644 --- a/src/display/editor/ink.js +++ b/src/display/editor/ink.js @@ -517,11 +517,9 @@ class InkEditor extends AnnotationEditor { // When commiting, the position of this editor is changed, hence we must // move it to the right position in the DOM. this.parent.moveEditorInDOM(this); - if (this.pageIndex === this._uiManager.currentPageIndex) { - // After the div has been moved in the DOM, the focus may have been stolen - // by document.body, hence we just keep it here. - this.div.focus(); - } + this.div.focus({ + preventScroll: true /* See issue #15744 */, + }); } /** @inheritdoc */