Only show popups when they've some contents to display
Chrome, Edge and Acrobat do that.
This commit is contained in:
parent
5653458b51
commit
96216de410
@ -185,8 +185,8 @@ class AnnotationElement {
|
||||
}
|
||||
}
|
||||
|
||||
static _hasPopupData({ titleObj, contentsObj, richText }) {
|
||||
return !!(titleObj?.str || contentsObj?.str || richText?.str);
|
||||
static _hasPopupData({ contentsObj, richText }) {
|
||||
return !!(contentsObj?.str || richText?.str);
|
||||
}
|
||||
|
||||
get _isEditable() {
|
||||
|
||||
@ -664,7 +664,7 @@ describe("ResetForm action", () => {
|
||||
});
|
||||
|
||||
describe("Rotated annotation and its clickable area", () => {
|
||||
describe("issue14438.pdf", () => {
|
||||
describe("rotated_ink.pdf", () => {
|
||||
let pages;
|
||||
|
||||
beforeEach(async () => {
|
||||
|
||||
@ -27,7 +27,6 @@ import {
|
||||
getFirstSerialized,
|
||||
getRect,
|
||||
getSerialized,
|
||||
hover,
|
||||
isCanvasMonochrome,
|
||||
kbBigMoveDown,
|
||||
kbBigMoveLeft,
|
||||
@ -1166,16 +1165,6 @@ describe("FreeText Editor", () => {
|
||||
await Promise.all(
|
||||
pages.map(async ([browserName, page]) => {
|
||||
await page.waitForSelector("[data-annotation-id='23R']");
|
||||
// Cannot use page.hover with Firefox on Mac because of a bug.
|
||||
// TODO: remove this when we switch to BiDi.
|
||||
await hover(page, "[data-annotation-id='23R']");
|
||||
|
||||
// Wait for the popup to be displayed.
|
||||
await page.waitForFunction(
|
||||
() =>
|
||||
document.querySelector("[data-annotation-id='popup_23R']")
|
||||
.hidden === false
|
||||
);
|
||||
|
||||
// Enter in editing mode.
|
||||
await switchToFreeText(page);
|
||||
@ -1183,15 +1172,7 @@ describe("FreeText Editor", () => {
|
||||
// Disable editing mode.
|
||||
await switchToFreeText(page, /* disable = */ true);
|
||||
|
||||
// TODO: remove this when we switch to BiDi.
|
||||
await hover(page, "[data-annotation-id='23R']");
|
||||
|
||||
// Wait for the popup to be displayed.
|
||||
await page.waitForFunction(
|
||||
() =>
|
||||
document.querySelector("[data-annotation-id='popup_23R']")
|
||||
.hidden === false
|
||||
);
|
||||
await page.waitForSelector("[data-annotation-id='23R']");
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
@ -623,11 +623,6 @@ async function firstPageOnTop(page) {
|
||||
return awaitPromise(handle);
|
||||
}
|
||||
|
||||
async function hover(page, selector) {
|
||||
const rect = await getRect(page, selector);
|
||||
await page.mouse.move(rect.x + rect.width / 2, rect.y + rect.height / 2);
|
||||
}
|
||||
|
||||
async function setCaretAt(page, pageNumber, text, position) {
|
||||
await page.evaluate(
|
||||
(pageN, string, pos) => {
|
||||
@ -912,7 +907,6 @@ export {
|
||||
getSerialized,
|
||||
getSpanRectFromText,
|
||||
getXY,
|
||||
hover,
|
||||
isCanvasMonochrome,
|
||||
kbBigMoveDown,
|
||||
kbBigMoveLeft,
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user