Hide comment popup after redo action

This commit is contained in:
Marco Castelluccio 2026-01-22 13:12:13 +01:00
parent 84d15dc453
commit bdc9323b15
No known key found for this signature in database
GPG Key ID: 7EC7F621C5F89953
2 changed files with 41 additions and 0 deletions

View File

@ -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 });

View File

@ -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 });
})
);
});
});
});