summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan-Christoph Borchardt <hey@jancborchardt.net>2018-07-17 13:10:25 +0200
committerJan-Christoph Borchardt <hey@jancborchardt.net>2018-07-20 23:19:55 +0200
commit6d083c4de975a4151026c5942d795f9ab299fd92 (patch)
tree067d055006ba817e0bcb87a23d8cdc2115fc8a22
parenta21be0ad97131b2d9f6cdc1affb2863e9760fa5c (diff)
downloadnextcloud-server-6d083c4de975a4151026c5942d795f9ab299fd92.tar.gz
nextcloud-server-6d083c4de975a4151026c5942d795f9ab299fd92.zip
Make left sidebar toggle also work with keyboard
Signed-off-by: Jan-Christoph Borchardt <hey@jancborchardt.net>
-rw-r--r--core/js/js.js17
1 files changed, 15 insertions, 2 deletions
diff --git a/core/js/js.js b/core/js/js.js
index c1713539f4f..699c2667bdc 100644
--- a/core/js/js.js
+++ b/core/js/js.js
@@ -1617,14 +1617,27 @@ function initCore() {
maxPosition: 250,
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'){
snapper.close();
} else {
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
var $appNavigation = $('#app-navigation');
$appNavigation.delegate('a, :button', 'click', function(event) {