Let toolbar focus routing skip disabled plugin buttons

This commit is contained in:
MinhHaDuong 2026-09-22 11:44:30 +02:00
parent f55d038913
commit a1d3eea8b2
2 changed files with 6 additions and 2 deletions

View file

@ -178,8 +178,7 @@ var ZoteroPane = new function () {
// toolbarbutton. Read the current buttons for each key event.
let pluginButtons = () => [...document.querySelectorAll(
'#zotero-items-toolbar > toolbarbutton[tabindex="0"]'
)].filter(button => !button.disabled && !button.hidden
&& getComputedStyle(button).display !== 'none');
)];
let titleBar = document.getElementById("zotero-title-bar");
let itemTree = document.getElementById("zotero-items-tree");
let collectionsTree = document.getElementById("zotero-collections-tree");

View file

@ -1964,6 +1964,11 @@ describe("ZoteroPane", function () {
buttons[0].style.display = 'none';
paneToggle.dispatchEvent(tab);
assert.equal(doc.activeElement, buttons[1]);
buttons[0].style.display = '';
buttons[0].disabled = true;
doc.getElementById('zotero-tb-add').focus();
buttons[0].dispatchEvent(tab);
assert.equal(doc.activeElement, buttons[1]);
}
finally {
buttons.forEach(button => button.remove());