From bdc9323b15a7702334c41b1c179806b1e919c521 Mon Sep 17 00:00:00 2001 From: Marco Castelluccio Date: Thu, 22 Jan 2026 13:12:13 +0100 Subject: [PATCH] Hide comment popup after redo action --- src/display/editor/tools.js | 1 + test/integration/comment_spec.mjs | 40 +++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) 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 }); + }) + ); + }); }); });