Skip to content

Commit

Permalink
[Annotation] Replace use of id by data-element-id to have the correct id
Browse files Browse the repository at this point in the history
  • Loading branch information
calixteman committed Oct 19, 2022
1 parent ba3a0e1 commit 4e3d07b
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/display/annotation_layer.js
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,8 @@ class AnnotationElement {
// Fallback to a regular DOM lookup, to ensure that the standalone
// viewer components won't break.
for (const domElement of document.getElementsByName(name)) {
const { id, exportValue } = domElement;
const { exportValue } = domElement;
const id = domElement.getAttribute("data-element-id");
if (id === skipId) {
continue;
}
Expand Down
25 changes: 25 additions & 0 deletions test/integration/annotation_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,31 @@ describe("Checkbox annotation", () => {
);
});
});

fdescribe("issue15597.pdf", () => {
let pages;

beforeAll(async () => {
pages = await loadAndWait("issue15597.pdf", "[data-annotation-id='7R']");
});

afterAll(async () => {
await closePages(pages);
});

it("must check the checkbox", async () => {
await Promise.all(
pages.map(async ([browserName, page]) => {
const selector = "[data-annotation-id='7R']";
await page.click(selector);
await page.waitForFunction(
`document.querySelector("${selector} > :first-child").checked`
);
expect(true).withContext(`In ${browserName}`).toEqual(true);
})
);
});
});
});

describe("Text widget", () => {
Expand Down
1 change: 1 addition & 0 deletions test/pdfs/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -547,3 +547,4 @@
!bug1782564.pdf
!issue15340.pdf
!bug1795263.pdf
!issue15597.pdf
Binary file added test/pdfs/issue15597.pdf
Binary file not shown.

0 comments on commit 4e3d07b

Please sign in to comment.