diff --git a/src/display/editor/tools.js b/src/display/editor/tools.js index 7767c024f..3f3b3c1da 100644 --- a/src/display/editor/tools.js +++ b/src/display/editor/tools.js @@ -1188,6 +1188,7 @@ class AnnotationEditorUIManager { }; const cmd = () => { this._editorUndoBar?.show(undo, "comment"); + this.toggleComment(/* editor = */ null); editor.comment = null; }; this.addCommands({ cmd, undo, mustExec: true }); diff --git a/test/integration/comment_spec.mjs b/test/integration/comment_spec.mjs index 2e4971c37..8fd5cad57 100644 --- a/test/integration/comment_spec.mjs +++ b/test/integration/comment_spec.mjs @@ -24,6 +24,8 @@ import { highlightSpan, kbModifierDown, kbModifierUp, + kbRedo, + kbUndo, loadAndWait, scrollIntoView, selectEditor, @@ -1137,5 +1139,43 @@ describe("Comment", () => { }) ); }); + + it("must check that the comment popup is hidden after redo", async () => { + await Promise.all( + pages.map(async ([browserName, page]) => { + await switchToHighlight(page); + await highlightSpan(page, 1, "Abstract"); + const editorSelector = getEditorSelector(0); + const comment = "Test comment for redo"; + await editComment(page, editorSelector, comment); + + // Show the popup by clicking the comment button + await waitAndClick( + page, + `${editorSelector} .annotationCommentButton` + ); + await page.waitForSelector("#commentPopup", { visible: true }); + + // Delete the comment + await waitAndClick(page, "button.commentPopupDelete"); + await page.waitForSelector("#editorUndoBar", { visible: true }); + + // Undo the deletion + await kbUndo(page); + await page.waitForSelector("#editorUndoBar", { hidden: true }); + + // Show the popup again by clicking the comment button + await waitAndClick( + page, + `${editorSelector} .annotationCommentButton` + ); + await page.waitForSelector("#commentPopup", { visible: true }); + + // Redo the deletion - popup should be hidden + await kbRedo(page); + await page.waitForSelector("#commentPopup", { hidden: true }); + }) + ); + }); }); });