From 4e3d07b912f5977cc12f50455910670e2cd4a308 Mon Sep 17 00:00:00 2001 From: Calixte Denizet Date: Wed, 19 Oct 2022 23:01:36 +0200 Subject: [PATCH] [Annotation] Replace use of id by data-element-id to have the correct id --- src/display/annotation_layer.js | 3 ++- test/integration/annotation_spec.js | 25 +++++++++++++++++++++++++ test/pdfs/.gitignore | 1 + test/pdfs/issue15597.pdf | Bin 0 -> 7933 bytes 4 files changed, 28 insertions(+), 1 deletion(-) create mode 100755 test/pdfs/issue15597.pdf diff --git a/src/display/annotation_layer.js b/src/display/annotation_layer.js index 1e9ed087e56f2b..1c7b738a3fed88 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 30b6c880682bf3..77c5806d478ae9 100644 --- a/test/integration/annotation_spec.js +++ b/test/integration/annotation_spec.js @@ -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", () => { diff --git a/test/pdfs/.gitignore b/test/pdfs/.gitignore index 055b2607de4a16..dd308124f35f2d 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 0000000000000000000000000000000000000000..bd24623b678e1de593a4b50838c52633de6cef44 GIT binary patch literal 7933 zcmeHMOLOD65w>P?(jkw{A@3@bQd8@xL;^wTL8)wS$(FtA+VR+HYib_5Ie;W6aZHgK zKF0P`{zX#x0ej6)$YGE9E4k&ETPhzwkfLqXj%TxTvusKP(A{W!Xf)7`hbNPRHtY18 z55N7-H~(!iVvyK*)!f=5bnGVaL7Xf|50$5c9*K;5JmX|ol#lZ)3?h*dCb>Xx!e_Fi z$){IKLFgVB!gxk@cA6scq-e9&ML~1yygJJkggzG0ESnQ%+k`$LjL?H1Ni))w%xRVg zzGzy+P`d4*lm&4#;h7+tlaXndCNtR3v`mBb|6rJ(7{(`$(7mLK6S6r*--5^?IXojL zNld=p?04HvkbV7#m}bZ7Kt#_5%TesDliKU8q=MbcUGY9*i}CAGXe7GtLZUkW2u}cj zM#3~}P)L~jgjpsT5Y{z`O{~FCfioGCP5QYA-+*H3<7-ARuE{Bpv$`L-u@^)$Rlwv= zVz;VdHi%Er2Re+SOpz!#Y@izGOFnVXktR}ffe1Z9zJe06_D@p5s!*8GiIOu>-^adB zn6{r6Fc#A&g<+ghJxO3{dr}0_T$D<(xA9p)K@SutQ$lyM2vhcj;@#bY9!AH27IgPB zyfgJK8Bd4_(~(AcD%?yq*>-2pWu!l}J3XTdMf$2dV0~4Fh_l?ulnp-%yqU-dos!MH zxp2?PZhXmrXkoqMD2g*VY^nY(PlbXGP%ZrlaE7_1m_)w7Vo>m{erXd)~A<8O9d9LAioj$xxnHte2rYb|s@mc|%5N>g%Q4&_wT6 ziuQ&ay(>)PINZ6tG3b4vzAY4ktFzT4dhW=_Hp#OczFdZZt2QQzY1yKyrW(Dnff4*} zE^Xy-vXke5HyXO!wuOV0WAk3S%T258c#hxhdA4iu9&-mnQ>k%uROh`V_b^H`9=W2F z+qYeBz#OM-^!mKrWro-0uJGG^*0cJ&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