From ed8e3f142bbee84786e0adeb2d7229aa3ac303b0 Mon Sep 17 00:00:00 2001 From: abaevbog Date: Wed, 24 Jan 2024 03:01:03 -0500 Subject: [PATCH] itempane keyboard navigation - right/left arrows on section header expand/collapse the sections - space/enter on section header toggle section collapsed/expanded - tab from the header goes through the header's buttons and then tabs into the section if that's opened - arrow up/down on the header jumps to the previous/next header - space/enter on clickable elements simulate a click - if there is a pinned section, tab from the title will focus its header --- chrome/content/zotero/contextPane.js | 2 + .../content/zotero/elements/attachmentBox.js | 43 +++++++++- .../zotero/elements/attachmentPreview.js | 34 ++++++++ .../content/zotero/elements/attachmentRow.js | 2 +- .../content/zotero/elements/attachmentsBox.js | 2 +- .../zotero/elements/collapsibleSection.js | 84 +++++++++++++++++-- chrome/content/zotero/elements/itemBox.js | 11 ++- .../elements/librariesCollectionsBox.js | 4 +- chrome/content/zotero/elements/notesBox.js | 4 +- chrome/content/zotero/elements/relatedBox.js | 4 +- chrome/content/zotero/itemPane.js | 45 ++++++++++ scss/elements/_attachmentBox.scss | 4 +- scss/elements/_attachmentPreview.scss | 1 + scss/elements/_collapsibleSection.scss | 11 ++- 14 files changed, 228 insertions(+), 23 deletions(-) diff --git a/chrome/content/zotero/contextPane.js b/chrome/content/zotero/contextPane.js index 1ad34a7a5e..4d833cf3c4 100644 --- a/chrome/content/zotero/contextPane.js +++ b/chrome/content/zotero/contextPane.js @@ -80,10 +80,12 @@ var ZoteroContextPane = new function () { window.addEventListener('resize', _update); Zotero.Reader.onChangeSidebarWidth = _updatePaneWidth; Zotero.Reader.onToggleSidebar = _updatePaneWidth; + _contextPaneInner.addEventListener("keypress", ZoteroItemPane.handleKeypress); }; this.destroy = function () { window.removeEventListener('resize', _update); + _contextPaneInner.removeEventListener("keypress", ZoteroItemPane.handleKeypress); Zotero.Notifier.unregisterObserver(this._notifierID); Zotero.Reader.onChangeSidebarWidth = () => {}; Zotero.Reader.onToggleSidebar = () => {}; diff --git a/chrome/content/zotero/elements/attachmentBox.js b/chrome/content/zotero/elements/attachmentBox.js index dc3f95c601..a07260c26d 100644 --- a/chrome/content/zotero/elements/attachmentBox.js +++ b/chrome/content/zotero/elements/attachmentBox.js @@ -32,8 +32,8 @@ content = MozXULElement.parseXULToFragment(` - -