1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-19 22:58:07 +02:00

Fix intermittent failures when moving a freetext annotation in integration tests

When an editor is moved with the keyboard or in dragging it, it is moved in the DOM in order
to make screen readers happy. But this move is slightly postponed thanks to a setTimeout(..., 0).
The failures were very likely due to the fact that intermittently the DOM move was done in
the middle of the next key sequence which was making the move on screen failing.
This commit is contained in:
Calixte Denizet 2024-12-08 22:16:41 +01:00
parent 6177bb5aa8
commit 74a377f72f
3 changed files with 54 additions and 86 deletions

View file

@ -1278,6 +1278,11 @@ class AnnotationEditor {
this.#moveInDOMTimeout = setTimeout(() => {
this.#moveInDOMTimeout = null;
this.parent?.moveEditorInDOM(this);
if (typeof PDFJSDev !== "undefined" && PDFJSDev.test("TESTING")) {
this._uiManager._eventBus.dispatch("editormovedindom", {
source: this,
});
}
}, 0);
}