From f990cb3f4ba5d0e34cabec3e78039983e5bea9e2 Mon Sep 17 00:00:00 2001 From: abaevbog Date: Wed, 24 Jan 2024 17:03:13 -0500 Subject: [PATCH] tabs menu updates - CMD-F will focus the input field - ArrowLeft/Right keypresses are ignored - Reset focus index on the focus of the input field --- chrome/content/zotero/tabs.js | 14 ++++++++++++++ chrome/content/zotero/zoteroPane.xhtml | 1 + 2 files changed, 15 insertions(+) diff --git a/chrome/content/zotero/tabs.js b/chrome/content/zotero/tabs.js index 3ed4fdfde7..6d3907d9b4 100644 --- a/chrome/content/zotero/tabs.js +++ b/chrome/content/zotero/tabs.js @@ -1005,6 +1005,10 @@ var Zotero_Tabs = new function () { this.refreshTabsMenuList(); }; + this.resetFocusIndex = (_) => { + this._tabsMenuFocusedIndex = 0; + }; + /** * Focus on the element in the tabs menu with [tabindex=tabIndex] if given @@ -1046,6 +1050,7 @@ var Zotero_Tabs = new function () { * - ArrowUp from the filter field focuses the last tab * - Home/PageUp focuses the filter field * - End/PageDown focues the last tab title + * - CMD-f will focus the input field */ this.handleTabsMenuKeyPress = function (event) { let tabindex = this._tabsMenuFocusedIndex; @@ -1114,5 +1119,14 @@ var Zotero_Tabs = new function () { } event.target.click(); } + else if (["ArrowLeft", "ArrowRight"].includes(event.key)) { + event.preventDefault(); + event.stopPropagation(); + } + else if (event.key == "f" && (Zotero.isMac ? event.metaKey : event.ctrlKey)) { + focusTabsMenuEntry(0); + event.preventDefault(); + event.stopPropagation(); + } }; }; diff --git a/chrome/content/zotero/zoteroPane.xhtml b/chrome/content/zotero/zoteroPane.xhtml index 0b0a61b96c..9ef7b73482 100644 --- a/chrome/content/zotero/zoteroPane.xhtml +++ b/chrome/content/zotero/zoteroPane.xhtml @@ -817,6 +817,7 @@