Select Items Dialog: restore tab order (#4442)

After redesign, tab order became: quickSearch -> itemTree ->
cancel and accept buttons -> collectionTree.

This restores original tab sequence: quickSearch -> collectionTree ->
itemsTree -> cancel and accept buttons.
This commit is contained in:
abaevbog 2024-07-26 23:16:38 -07:00 committed by GitHub
parent 6a99fb673a
commit 8b67fbcdce
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -104,6 +104,19 @@ var doLoad = async function () {
document.addEventListener('dialogaccept', doAccept);
if (isSelectItemsDialog) {
// Set proper tab order. It is only needed in selectItemsDialog -- other dialogs' focus order is correct
document.querySelector("#zotero-tb-search").searchModePopup.parentNode.setAttribute("tabindex", 1);
document.querySelector("#zotero-tb-search").searchTextbox.inputField.setAttribute("tabindex", 2);
document.querySelector("#collection-tree").setAttribute("tabindex", 3);
document.querySelector("#zotero-items-tree .virtualized-table").setAttribute("tabindex", 4);
// On Windows, buttons are in a different order than on macOS, so set tabindex accordingly
let nextButtonTabindex = 5;
for (let button of [...document.querySelectorAll("button[dlgtype]:not([hidden])")]) {
button.setAttribute("tabindex", nextButtonTabindex++);
}
}
// Used in tests
loaded = true;
};