context notes pane focus fixes (#4864)
- shift-tab from a note row focuses section header's twisty - tab from reader into context pane will focus search field. Previously focused note row will be focused on tab from a section header's twisty - fix focus not leaving context notes pane if all sections are collapsed - shift-tab from sidenav will focus the last node in the contextPane, instead of search input. That is to have consistent tab order in each direction. Fixes: #4858
This commit is contained in:
parent
2e202a59c9
commit
d698287558
3 changed files with 9 additions and 11 deletions
|
@ -202,14 +202,16 @@
|
|||
};
|
||||
|
||||
// ArrowUp/Down navigation between notes
|
||||
// Tab from a note-row focuses sidenav, Shift-Tab from a note focuses the section header
|
||||
// Tab from a note-row focuses sidenav, Shift-Tab from a note focuses the twisty of the section header
|
||||
// Tab from twisty icon into the notes list will try to refocus the last focused note
|
||||
_handleKeyDown = (event) => {
|
||||
if (event.key == "Tab" && event.target.classList.contains("twisty")) {
|
||||
if (event.key == "Tab" && !event.shiftKey && event.target.classList.contains("twisty")) {
|
||||
let section = event.target.closest("collapsible-section");
|
||||
if (this._lastFocusedNote && section.contains(this._lastFocusedNote)) {
|
||||
this.refocusLastFocusedNote();
|
||||
event.preventDefault();
|
||||
let refocused = this.refocusLastFocusedNote();
|
||||
if (refocused) {
|
||||
event.preventDefault();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (event.target.tagName !== "note-row" && !event.target.classList.contains("more")) return;
|
||||
|
@ -225,8 +227,7 @@
|
|||
event.preventDefault();
|
||||
}
|
||||
else if (event.key == "Tab" && event.shiftKey) {
|
||||
Services.focus.moveFocus(window, event.target.closest("collapsible-section"),
|
||||
Services.focus.MOVEFOCUS_FORWARD, 0);
|
||||
event.target.closest("collapsible-section").querySelector(".twisty").focus();
|
||||
event.preventDefault();
|
||||
}
|
||||
};
|
||||
|
|
|
@ -392,7 +392,7 @@
|
|||
if (event.key == "Tab" && event.shiftKey) {
|
||||
event.preventDefault();
|
||||
if (this._contextNotesPaneVisible && this._contextNotesPane.selectedPanel.mode == "notesList") {
|
||||
let focusHandled = this._contextNotesPane.selectedPanel.focus();
|
||||
let focusHandled = this._contextNotesPane.selectedPanel.notesList.refocusLastFocusedNote();
|
||||
if (focusHandled) return;
|
||||
}
|
||||
// Shift-Tab out of sidenav to itemPane
|
||||
|
|
|
@ -152,10 +152,7 @@
|
|||
|
||||
focus() {
|
||||
if (this.mode == "notesList") {
|
||||
let refocused = this.notesList.refocusLastFocusedNote();
|
||||
if (!refocused) {
|
||||
this.input.focus();
|
||||
}
|
||||
this.input.focus();
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
|
|
Loading…
Reference in a new issue