Make left sidebar toggle also work with keyboard

Signed-off-by: Jan-Christoph Borchardt <hey@jancborchardt.net>
This commit is contained in:
Jan-Christoph Borchardt 2018-07-17 13:10:25 +02:00
parent a21be0ad97
commit 6d083c4de9
No known key found for this signature in database
GPG Key ID: CBD846FC845CBE17
1 changed files with 15 additions and 2 deletions

View File

@ -1617,14 +1617,27 @@ function initCore() {
maxPosition: 250, maxPosition: 250,
minDragDistance: 100 minDragDistance: 100
}); });
$('#app-content').prepend('<div id="app-navigation-toggle" class="icon-menu" style="display:none;"></div>');
$('#app-navigation-toggle').click(function(){ $('#app-content').prepend('<div id="app-navigation-toggle" class="icon-menu" style="display:none;" tabindex="0"></div>');
var toggleSnapperOnButton = function(){
if(snapper.state().state == 'left'){ if(snapper.state().state == 'left'){
snapper.close(); snapper.close();
} else { } else {
snapper.open('left'); snapper.open('left');
} }
};
$('#app-navigation-toggle').click(function(){
toggleSnapperOnButton();
}); });
$('#app-navigation-toggle').keypress(function(e) {
if(e.which == 13) {
toggleSnapperOnButton();
}
});
// close sidebar when switching navigation entry // close sidebar when switching navigation entry
var $appNavigation = $('#app-navigation'); var $appNavigation = $('#app-navigation');
$appNavigation.delegate('a, :button', 'click', function(event) { $appNavigation.delegate('a, :button', 'click', function(event) {