From 7742c3eb6372f9a20f48f4685b29ec3958a05447 Mon Sep 17 00:00:00 2001 From: Calixte Denizet Date: Fri, 3 May 2024 14:39:37 +0200 Subject: [PATCH] Avoid to aria-hide the structure tree (bug 1894849) If one ancestor of the structure tree has the attribute aria-hidden then it's invisible for screen readers. --- test/integration/accessibility_spec.mjs | 12 ++++++++++++ web/pdf_page_view.js | 1 - 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/test/integration/accessibility_spec.mjs b/test/integration/accessibility_spec.mjs index 9ed7eda50..b628a4283 100644 --- a/test/integration/accessibility_spec.mjs +++ b/test/integration/accessibility_spec.mjs @@ -31,6 +31,18 @@ describe("accessibility", () => { await Promise.all( pages.map(async ([browserName, page]) => { await page.waitForSelector(".structTree"); + const isVisible = await page.evaluate(() => { + let elem = document.querySelector(".structTree"); + while (elem) { + if (elem.getAttribute("aria-hidden") === "true") { + return false; + } + elem = elem.parentElement; + } + return true; + }); + + expect(isVisible).withContext(`In ${browserName}`).toBeTrue(); // Check the headings match up. const head1 = await page.$eval( diff --git a/web/pdf_page_view.js b/web/pdf_page_view.js index e6ff86bba..5c4d9d4e0 100644 --- a/web/pdf_page_view.js +++ b/web/pdf_page_view.js @@ -908,7 +908,6 @@ class PDFPageView { // overflow will be hidden in Firefox. const canvasWrapper = document.createElement("div"); canvasWrapper.classList.add("canvasWrapper"); - canvasWrapper.setAttribute("aria-hidden", true); this.#addLayer(canvasWrapper, "canvasWrapper"); if (