Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Annotation] Replace use of id by data-element-id to have the correct id (bug 1796544) #15598

Merged
merged 1 commit into from
Oct 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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", () => {
);
});
});

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", () => {
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.