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.
This commit is contained in:
abaevbog 2024-04-16 04:12:51 -04:00 committed by GitHub
parent d4905854eb
commit 363f97325f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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"]