From 8b67fbcdce3d298b9f7f17a8f8b464b70a685e31 Mon Sep 17 00:00:00 2001 From: abaevbog Date: Fri, 26 Jul 2024 23:16:38 -0700 Subject: [PATCH] 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. --- chrome/content/zotero/selectItemsDialog.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/chrome/content/zotero/selectItemsDialog.js b/chrome/content/zotero/selectItemsDialog.js index b86f432888..f4bdf51c43 100644 --- a/chrome/content/zotero/selectItemsDialog.js +++ b/chrome/content/zotero/selectItemsDialog.js @@ -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; };