Skip to content

Commit bdc9323

Browse files
committed
Hide comment popup after redo action
1 parent 84d15dc commit bdc9323

2 files changed

Lines changed: 41 additions & 0 deletions

File tree

src/display/editor/tools.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1188,6 +1188,7 @@ class AnnotationEditorUIManager {
11881188
};
11891189
const cmd = () => {
11901190
this._editorUndoBar?.show(undo, "comment");
1191+
this.toggleComment(/* editor = */ null);
11911192
editor.comment = null;
11921193
};
11931194
this.addCommands({ cmd, undo, mustExec: true });

test/integration/comment_spec.mjs

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ import {
2424
highlightSpan,
2525
kbModifierDown,
2626
kbModifierUp,
27+
kbRedo,
28+
kbUndo,
2729
loadAndWait,
2830
scrollIntoView,
2931
selectEditor,
@@ -1137,5 +1139,43 @@ describe("Comment", () => {
11371139
})
11381140
);
11391141
});
1142+
1143+
it("must check that the comment popup is hidden after redo", async () => {
1144+
await Promise.all(
1145+
pages.map(async ([browserName, page]) => {
1146+
await switchToHighlight(page);
1147+
await highlightSpan(page, 1, "Abstract");
1148+
const editorSelector = getEditorSelector(0);
1149+
const comment = "Test comment for redo";
1150+
await editComment(page, editorSelector, comment);
1151+
1152+
// Show the popup by clicking the comment button
1153+
await waitAndClick(
1154+
page,
1155+
`${editorSelector} .annotationCommentButton`
1156+
);
1157+
await page.waitForSelector("#commentPopup", { visible: true });
1158+
1159+
// Delete the comment
1160+
await waitAndClick(page, "button.commentPopupDelete");
1161+
await page.waitForSelector("#editorUndoBar", { visible: true });
1162+
1163+
// Undo the deletion
1164+
await kbUndo(page);
1165+
await page.waitForSelector("#editorUndoBar", { hidden: true });
1166+
1167+
// Show the popup again by clicking the comment button
1168+
await waitAndClick(
1169+
page,
1170+
`${editorSelector} .annotationCommentButton`
1171+
);
1172+
await page.waitForSelector("#commentPopup", { visible: true });
1173+
1174+
// Redo the deletion - popup should be hidden
1175+
await kbRedo(page);
1176+
await page.waitForSelector("#commentPopup", { hidden: true });
1177+
})
1178+
);
1179+
});
11401180
});
11411181
});

0 commit comments

Comments
 (0)