Merge pull request #16889 from calixteman/fix_aria_controls_id

Fix the id used in aria-controls used to make a relationship between the popup and its parent
This commit is contained in:
calixteman 2023-08-31 16:06:11 +02:00 committed by GitHub
commit 14b2a31e78
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 1 deletions

View File

@ -1954,7 +1954,10 @@ class PopupAnnotationElement extends AnnotationElement {
element.addHighlightArea();
}
this.container.setAttribute("aria-controls", elementIds.join(","));
this.container.setAttribute(
"aria-controls",
elementIds.map(id => `${AnnotationPrefix}${id}`).join(",")
);
return this.container;
}

View File

@ -151,6 +151,24 @@ describe("accessibility", () => {
await closePages(pages);
});
it("must check the id in aria-controls", async () => {
await Promise.all(
pages.map(async ([browserName, page]) => {
await page.waitForSelector(".annotationLayer");
const stampId = "pdfjs_internal_id_20R";
await page.click(`#${stampId}`);
const controlledId = await page.$eval(
"#pdfjs_internal_id_21R",
el => document.getElementById(el.getAttribute("aria-controls")).id
);
expect(controlledId)
.withContext(`In ${browserName}`)
.toEqual(stampId);
})
);
});
it("must check that the stamp annotation is linked to the struct tree", async () => {
await Promise.all(
pages.map(async ([browserName, page]) => {