From a7e1035b77cefd74533f2db33f0c7e75092db834 Mon Sep 17 00:00:00 2001 From: abaevbog Date: Tue, 15 Apr 2025 22:53:54 -0700 Subject: [PATCH] a11y: clear aria-expanded on empty itemTree rows (#5201) Per https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Reference/Attributes/aria-expanded#treeitems only treeitems that contain children should have the aria-expanded attribute. This is instead of having aria-expanded="false" on empty regular items or standalone attachments, which erroneously indicates to screen readers that the row has children but is collapsed. Fixes: #5200 --- chrome/content/zotero/itemTree.jsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/chrome/content/zotero/itemTree.jsx b/chrome/content/zotero/itemTree.jsx index 0bc062f0a4..7f945c3d36 100644 --- a/chrome/content/zotero/itemTree.jsx +++ b/chrome/content/zotero/itemTree.jsx @@ -3097,7 +3097,10 @@ var ItemTree = class ItemTree extends LibraryTree { // Accessibility div.setAttribute('role', 'treeitem'); div.setAttribute('aria-level', this.getLevel(index) + 1); - if (!this.isContainerEmpty(index)) { + if (this.isContainerEmpty(index)) { + div.removeAttribute('aria-expanded'); + } + else { div.setAttribute('aria-expanded', this.isContainerOpen(index)); } if (rowData.contextRow) {