[Editor] Correctly focus the annotation once the comment has been removed in the annotation layer (bug 1994738)
This commit is contained in:
parent
745e42701f
commit
fd3f7528b6
@ -2685,6 +2685,10 @@ class PopupElement {
|
|||||||
this.#firstElement.commentText = this.#commentText = text;
|
this.#firstElement.commentText = this.#commentText = text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
focus() {
|
||||||
|
this.#firstElement.container?.focus();
|
||||||
|
}
|
||||||
|
|
||||||
get parentBoundingClientRect() {
|
get parentBoundingClientRect() {
|
||||||
return this.#firstElement.layer.getBoundingClientRect();
|
return this.#firstElement.layer.getBoundingClientRect();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -798,4 +798,44 @@ describe("Comment", () => {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe("Focus annotation after comment has been deleted (bug 1994738)", () => {
|
||||||
|
let pages;
|
||||||
|
|
||||||
|
beforeEach(async () => {
|
||||||
|
pages = await loadAndWait(
|
||||||
|
"tracemonkey.pdf",
|
||||||
|
".annotationEditorLayer",
|
||||||
|
"page-fit",
|
||||||
|
null,
|
||||||
|
{ enableComment: true }
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
afterEach(async () => {
|
||||||
|
await closePages(pages);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("must check that the annotation is focused", async () => {
|
||||||
|
await Promise.all(
|
||||||
|
pages.map(async ([browserName, page]) => {
|
||||||
|
await switchToHighlight(page);
|
||||||
|
await highlightSpan(page, 1, "Abstract");
|
||||||
|
const editorSelector = getEditorSelector(0);
|
||||||
|
await editComment(page, editorSelector, "Hello world!");
|
||||||
|
|
||||||
|
await switchToHighlight(page, /* disable = */ true);
|
||||||
|
await waitAndClick(page, ".annotationLayer .annotationCommentButton");
|
||||||
|
|
||||||
|
const handle = await createPromise(page, resolve => {
|
||||||
|
document
|
||||||
|
.querySelector(".annotationLayer section.editorAnnotation")
|
||||||
|
.addEventListener("focus", resolve, { once: true });
|
||||||
|
});
|
||||||
|
await waitAndClick(page, "button.commentPopupDelete");
|
||||||
|
await awaitPromise(handle);
|
||||||
|
})
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user