summaryrefslogtreecommitdiffstats
path: root/core/js
diff options
context:
space:
mode:
authorJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2018-07-20 20:51:23 +0200
committerJan-Christoph Borchardt <hey@jancborchardt.net>2018-07-20 23:19:55 +0200
commit7f0d60fefcab33c5ed52e1cf338277397f63149e (patch)
treecf87f3226e195be4e56ef61c312b9b861d604515 /core/js
parentfe38e33d1093c2832e4b5b7049b05c0bf37fffda (diff)
downloadnextcloud-server-7f0d60fefcab33c5ed52e1cf338277397f63149e.tar.gz
nextcloud-server-7f0d60fefcab33c5ed52e1cf338277397f63149e.zip
Enter key on menu registration
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Diffstat (limited to 'core/js')
-rw-r--r--core/js/js.js14
1 files changed, 13 insertions, 1 deletions
diff --git a/core/js/js.js b/core/js/js.js
index 699c2667bdc..015517020b4 100644
--- a/core/js/js.js
+++ b/core/js/js.js
@@ -684,10 +684,15 @@ var OCP = {},
registerMenu: function($toggle, $menuEl, toggle, headerMenu) {
var self = this;
$menuEl.addClass('menu');
- $toggle.on('click.menu', function(event) {
+ $toggle.on('click.menu keypress.menu', function(event) {
// prevent the link event (append anchor to URL)
event.preventDefault();
+ // allow enter key as a trigger
+ if (event.keyCode && event.keyCode !== 13) {
+ return;
+ }
+
if ($menuEl.is(OC._currentMenu)) {
self.hideMenus();
return;
@@ -1422,7 +1427,14 @@ function initCore() {
OC.registerMenu($('#expand'), $('#expanddiv'), false, true);
// toggle for menus
+ //$(document).on('mouseup.closemenus keyup', function(event) {
$(document).on('mouseup.closemenus', function(event) {
+
+ // allow enter as a trigger
+ // if (event.keyCode && event.keyCode !== 13) {
+ // return;
+ // }
+
var $el = $(event.target);
if ($el.closest('.menu').length || $el.closest('.menutoggle').length) {
// don't close when clicking on the menu directly or a menu toggle