mirror of
https://github.com/zotero/zotero.git
synced 2026-08-28 05:25:31 +00:00
Merge 808cd16183 into 753dbf557a
This commit is contained in:
commit
dbcfff5dab
2 changed files with 38 additions and 15 deletions
|
|
@ -745,21 +745,25 @@
|
|||
});
|
||||
firstBtn.dispatchEvent(clickEvent);
|
||||
}
|
||||
setTimeout(() => {
|
||||
// If notes are visible, tab into them
|
||||
if (this._contextNotesPaneVisible) {
|
||||
Services.focus.moveFocus(window, this.contextNotesPane, Services.focus.MOVEFOCUS_FORWARD, 0);
|
||||
}
|
||||
// Tab into the pinned section if it exists
|
||||
else if (this.pinnedPane) {
|
||||
Services.focus.moveFocus(window, this.container.getEnabledPane(this.pinnedPane),
|
||||
Services.focus.MOVEFOCUS_FORWARD, 0);
|
||||
}
|
||||
// Otherwise, focus the top-level scrollable itemPane
|
||||
else {
|
||||
this._container.querySelector(".zotero-view-item").focus();
|
||||
}
|
||||
});
|
||||
// Otherwise, just click on the focused button
|
||||
else if (event.target.classList.contains("btn")) {
|
||||
event.preventDefault();
|
||||
event.target.click();
|
||||
}
|
||||
|
||||
// If notes are visible, tab into them
|
||||
if (this._contextNotesPaneVisible) {
|
||||
Services.focus.moveFocus(window, this.contextNotesPane, Services.focus.MOVEFOCUS_FORWARD, 0);
|
||||
}
|
||||
// Tab into the pinned section if it exists
|
||||
else if (this.pinnedPane) {
|
||||
Services.focus.moveFocus(window, this.container.getEnabledPane(this.pinnedPane),
|
||||
Services.focus.MOVEFOCUS_FORWARD, 0);
|
||||
}
|
||||
// Otherwise, focus the top-level scrollable itemPane
|
||||
else {
|
||||
this._container.querySelector(".zotero-view-item").focus();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -779,6 +779,25 @@ class ReaderInstance {
|
|||
|
||||
async setContextPaneOpen(open) {
|
||||
await this._initPromise;
|
||||
|
||||
// There are two toggle-pane buttons: in the reader and in the sidenav. Closing/opening
|
||||
// the context pane may display one and hide the other. If a focused toggle-pane btn is being hidden,
|
||||
// try to focus the other toggle-pane btn so that focus is not just lost.
|
||||
if (!open && this._window.document.activeElement.dataset.action == "toggle-pane") {
|
||||
// Context pane collapsed when sidenav button is focused - try to focus btn in reader toolbar
|
||||
setTimeout(() => {
|
||||
this._iframeWindow.document.querySelector(".context-pane-toggle").focus({ focusVisible: true });
|
||||
});
|
||||
}
|
||||
else if (open && this._iframeWindow.document.activeElement.classList.contains("context-pane-toggle")) {
|
||||
// Context pane expanded when toggle-pane in reader toolbar is focused.
|
||||
// Try to focus the sidenav button, if reader's button was hidden
|
||||
setTimeout(() => {
|
||||
if (this._iframeWindow.document.querySelector("context-pane-toggle")) return;
|
||||
this._window.document.querySelector("#zotero-context-pane-sidenav .btn[data-action='toggle-pane']").focus({ focusVisible: true });
|
||||
});
|
||||
}
|
||||
|
||||
this._internalReader.setContextPaneOpen(open);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue