From 363f97325feda4143144e3d6763e065c20131718 Mon Sep 17 00:00:00 2001 From: abaevbog Date: Tue, 16 Apr 2024 04:12:51 -0400 Subject: [PATCH] vpat 9: set aria properties on the sync button (#3988) Set the aria-label on the sync button. On focus, register the sync status and set the aria-description to be the last sync status. --- chrome/content/zotero/zoteroPane.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/chrome/content/zotero/zoteroPane.js b/chrome/content/zotero/zoteroPane.js index 9c6f0a392c..544c752754 100644 --- a/chrome/content/zotero/zoteroPane.js +++ b/chrome/content/zotero/zoteroPane.js @@ -137,9 +137,16 @@ var ZoteroPane = new function() // Set the sync tooltip label Components.utils.import("resource://zotero/config.js"); - document.getElementById('zotero-tb-sync-label').value = Zotero.getString( - 'sync.syncWith', ZOTERO_CONFIG.DOMAIN_NAME - ); + let syncLabel = document.getElementById('zotero-tb-sync-label'); + syncLabel.value = Zotero.getString('sync.syncWith', ZOTERO_CONFIG.DOMAIN_NAME); + let syncButton = document.querySelector("#zotero-tb-sync"); + syncButton.setAttribute("aria-label", syncLabel.value); + // Update the aria-description on focus + syncButton.addEventListener("focus", function (_) { + Zotero.Sync.Runner.registerSyncStatus(this.firstChild); + let lastSync = document.querySelector("#zotero-tb-sync-last-sync").value; + this.setAttribute("aria-description", lastSync || ""); + }); // register an observer for Zotero reload observerService = Components.classes["@mozilla.org/observer-service;1"]