diff --git a/src/display/annotation_layer.js b/src/display/annotation_layer.js index 1e9ed087e56f2..1c7b738a3fed8 100644 --- a/src/display/annotation_layer.js +++ b/src/display/annotation_layer.js @@ -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; } diff --git a/test/integration/annotation_spec.js b/test/integration/annotation_spec.js index 30b6c880682bf..8b6617eed5c33 100644 --- a/test/integration/annotation_spec.js +++ b/test/integration/annotation_spec.js @@ -95,6 +95,31 @@ describe("Checkbox annotation", () => { ); }); }); + + describe("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", () => { diff --git a/test/pdfs/.gitignore b/test/pdfs/.gitignore index 055b2607de4a1..dd308124f35f2 100644 --- a/test/pdfs/.gitignore +++ b/test/pdfs/.gitignore @@ -547,3 +547,4 @@ !bug1782564.pdf !issue15340.pdf !bug1795263.pdf +!issue15597.pdf diff --git a/test/pdfs/issue15597.pdf b/test/pdfs/issue15597.pdf new file mode 100755 index 0000000000000..bd24623b678e1 Binary files /dev/null and b/test/pdfs/issue15597.pdf differ