Skip to content

Commit 96216de

Browse files
committed
Only show popups when they've some contents to display
Chrome, Edge and Acrobat do that.
1 parent 5653458 commit 96216de

6 files changed

Lines changed: 4 additions & 29 deletions

File tree

src/display/annotation_layer.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,8 @@ class AnnotationElement {
185185
}
186186
}
187187

188-
static _hasPopupData({ titleObj, contentsObj, richText }) {
189-
return !!(titleObj?.str || contentsObj?.str || richText?.str);
188+
static _hasPopupData({ contentsObj, richText }) {
189+
return !!(contentsObj?.str || richText?.str);
190190
}
191191

192192
get _isEditable() {

test/integration/annotation_spec.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -664,7 +664,7 @@ describe("ResetForm action", () => {
664664
});
665665

666666
describe("Rotated annotation and its clickable area", () => {
667-
describe("issue14438.pdf", () => {
667+
describe("rotated_ink.pdf", () => {
668668
let pages;
669669

670670
beforeEach(async () => {

test/integration/freetext_editor_spec.mjs

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ import {
2727
getFirstSerialized,
2828
getRect,
2929
getSerialized,
30-
hover,
3130
isCanvasMonochrome,
3231
kbBigMoveDown,
3332
kbBigMoveLeft,
@@ -1166,32 +1165,14 @@ describe("FreeText Editor", () => {
11661165
await Promise.all(
11671166
pages.map(async ([browserName, page]) => {
11681167
await page.waitForSelector("[data-annotation-id='23R']");
1169-
// Cannot use page.hover with Firefox on Mac because of a bug.
1170-
// TODO: remove this when we switch to BiDi.
1171-
await hover(page, "[data-annotation-id='23R']");
1172-
1173-
// Wait for the popup to be displayed.
1174-
await page.waitForFunction(
1175-
() =>
1176-
document.querySelector("[data-annotation-id='popup_23R']")
1177-
.hidden === false
1178-
);
11791168

11801169
// Enter in editing mode.
11811170
await switchToFreeText(page);
11821171

11831172
// Disable editing mode.
11841173
await switchToFreeText(page, /* disable = */ true);
11851174

1186-
// TODO: remove this when we switch to BiDi.
1187-
await hover(page, "[data-annotation-id='23R']");
1188-
1189-
// Wait for the popup to be displayed.
1190-
await page.waitForFunction(
1191-
() =>
1192-
document.querySelector("[data-annotation-id='popup_23R']")
1193-
.hidden === false
1194-
);
1175+
await page.waitForSelector("[data-annotation-id='23R']");
11951176
})
11961177
);
11971178
});

test/integration/test_utils.mjs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -623,11 +623,6 @@ async function firstPageOnTop(page) {
623623
return awaitPromise(handle);
624624
}
625625

626-
async function hover(page, selector) {
627-
const rect = await getRect(page, selector);
628-
await page.mouse.move(rect.x + rect.width / 2, rect.y + rect.height / 2);
629-
}
630-
631626
async function setCaretAt(page, pageNumber, text, position) {
632627
await page.evaluate(
633628
(pageN, string, pos) => {
@@ -912,7 +907,6 @@ export {
912907
getSerialized,
913908
getSpanRectFromText,
914909
getXY,
915-
hover,
916910
isCanvasMonochrome,
917911
kbBigMoveDown,
918912
kbBigMoveLeft,

test/pdfs/rotated_ink.pdf

4.7 KB
Binary file not shown.

test/pdfs/tagged_stamp.pdf

-2.68 KB
Binary file not shown.

0 commit comments

Comments
 (0)