Switch to next tab with Shift+T shortcut even if tab is currently closed
Often users can remember what the recently opened tab was, so we can switch to and open the next tab immediately, saving one keypress. There is a dedicated shortcut (T) for only opening a tab, after all. While the previous behavior for Shift+T (open tab without switching to next if currently closed) was by intention, user testing found that the new approach might be more desirable.
This commit is contained in:
parent
f2dd3b95a4
commit
e3a9f6206f
1 changed files with 12 additions and 12 deletions
|
|
@ -123,24 +123,24 @@ BR.Sidebar = L.Control.Sidebar.extend({
|
|||
_keydownListener: function(e) {
|
||||
if (BR.Util.keyboardShortcutsAllowed(e) && e.keyCode === this.options.shortcut.toggleTabs) {
|
||||
if ($('#sidebarTabs > ul > li[class=active]').length) {
|
||||
// sidebar is currently open
|
||||
if (e.shiftKey) {
|
||||
// try to find next tab
|
||||
var nextTab = $('#sidebarTabs > ul > li[class=active] ~ li:not([hidden]) > a');
|
||||
if (!nextTab.length) {
|
||||
// wrap around to first tab
|
||||
nextTab = $('#sidebarTabs > ul > li:not([hidden]) > a');
|
||||
}
|
||||
// switch to next or first tab
|
||||
this.open(nextTab.attr('href').slice(1));
|
||||
} else {
|
||||
// close current tab
|
||||
// sidebar is currently open, close current tab
|
||||
if (!e.shiftKey) {
|
||||
this.close();
|
||||
}
|
||||
} else {
|
||||
// sidebar is currently closed, open recent or default tab
|
||||
this.open(this.recentTab);
|
||||
}
|
||||
if (e.shiftKey) {
|
||||
// try to find next tab
|
||||
var nextTab = $('#sidebarTabs > ul > li[class=active] ~ li:not([hidden]) > a');
|
||||
if (!nextTab.length) {
|
||||
// wrap around to first tab
|
||||
nextTab = $('#sidebarTabs > ul > li:not([hidden]) > a');
|
||||
}
|
||||
// switch to next or first tab
|
||||
this.open(nextTab.attr('href').slice(1));
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue