From c5027106c2cccb26e5b3092e3b87947fcce91e26 Mon Sep 17 00:00:00 2001 From: abaevbog Date: Sun, 4 Aug 2024 21:39:39 -0700 Subject: [PATCH] fix keyboard focus not landing on feeds itemTree (#4495) Do not use specific "#item-tree-main-default" selector to find the itemTree node to focus since a different id can be set for the table, e.g for the list of feeds. Use a more general "zotero-items-tree .virtualized-table" selector to focus the itemTree on tab from quickSearch and on Escape keypress from an editable-text of itemPane. Fixes: #4494 --- chrome/content/zotero/elements/itemDetails.js | 2 +- chrome/content/zotero/zoteroPane.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/chrome/content/zotero/elements/itemDetails.js b/chrome/content/zotero/elements/itemDetails.js index 379eb40b66..4c03a0fb71 100644 --- a/chrome/content/zotero/elements/itemDetails.js +++ b/chrome/content/zotero/elements/itemDetails.js @@ -568,7 +568,7 @@ // On Escape/Enter on editable-text, return focus to the item tree or reader if (event.key == "Escape" || (event.key == "Enter" && event.target.classList.contains('input'))) { if (isLibraryTab) { - document.getElementById('item-tree-main-default').focus(); + document.querySelector('#zotero-items-tree .virtualized-table').focus(); } else { let reader = Zotero.Reader.getByTabID(Zotero_Tabs.selectedID); diff --git a/chrome/content/zotero/zoteroPane.js b/chrome/content/zotero/zoteroPane.js index 428d555e29..17c59252d6 100644 --- a/chrome/content/zotero/zoteroPane.js +++ b/chrome/content/zotero/zoteroPane.js @@ -407,7 +407,7 @@ var ZoteroPane = new function() ShiftTab: () => { document.getElementById("zotero-tb-search")._searchModePopup.flattenedTreeParentNode.focus(); }, - Tab: () => document.getElementById('item-tree-main-default') + Tab: () => itemTree.querySelector(".virtualized-table") }, 'zotero-tb-search-dropmarker': { ArrowNext: () => null,