From 53ad856ef4a9048f2d822511275a78ae2fc56c32 Mon Sep 17 00:00:00 2001 From: abaevbog Date: Tue, 13 Aug 2024 13:46:46 -0700 Subject: [PATCH] vpat 31 and 33 - aria tweaks for Tools > Plugins (#4560) - vpat 31: mark which menuitems' button is checked, otherwise selected options (e.g. Update plugins automatically) are not announced as such - vpat 33: when plugin details pane appears, remove a misleading role="tabpanel" from its section because it is not structured as a collection of tabs --- chrome/content/zotero/standalone/standalone.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/chrome/content/zotero/standalone/standalone.js b/chrome/content/zotero/standalone/standalone.js index 089de41e2e..6dce0b1da5 100644 --- a/chrome/content/zotero/standalone/standalone.js +++ b/chrome/content/zotero/standalone/standalone.js @@ -715,6 +715,24 @@ const ZoteroStandalone = new function() { ); return { remove: result === 0, report: null }; }; + // A11y: when a popup appears, mark which buttons are checked for screen readers + doc.addEventListener("shown", (event) => { + for (let item of [...event.target.querySelectorAll("panel-item")]) { + item.button.setAttribute("role", "menuitemcheckbox"); + item.button.setAttribute("aria-checked", item.checked); + } + }, true); + + // A11y: after a click, check if the panel with plugin details appeared. + // If so, delete a misleading role=tabpanel because default firefox tabs + // ("Details" and "Permissions") are explicitly hidden in fetch_xulrunner + doc.addEventListener("click", (_) => { + setTimeout(() => { + let details = doc.querySelector("#details-deck section[role='tabpanel']"); + if (!details) return; + details.removeAttribute("role"); + }); + }, true); } /**