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
This commit is contained in:
parent
69054bea4a
commit
f990cb3f4b
2 changed files with 15 additions and 0 deletions
|
@ -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();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
|
|
@ -817,6 +817,7 @@
|
|||
<vbox width="350" id="zotero-tabs-menu-wrapper">
|
||||
<html:input id="zotero-tabs-menu-filter"
|
||||
oninput="Zotero_Tabs.handleTabsMenuFilterInput(event, this)"
|
||||
onfocus="Zotero_Tabs.resetFocusIndex()"
|
||||
tabindex="0"
|
||||
data-l10n-id="zotero-tabs-menu-filter"
|
||||
/>
|
||||
|
|
Loading…
Reference in a new issue