Fix keyboard menu element event detection

Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
This commit is contained in:
John Molakvoæ (skjnldsv) 2018-08-22 09:47:00 +02:00
parent e0f29cadaf
commit ba66cad1b4
No known key found for this signature in database
GPG Key ID: 60C25B8C072916CF
1 changed files with 7 additions and 2 deletions

View File

@ -684,7 +684,12 @@ var OCP = {},
registerMenu: function($toggle, $menuEl, toggle, headerMenu) {
var self = this;
$menuEl.addClass('menu');
$toggle.on('click.menu keyup.menu', function(event) {
// On link, the enter key trigger a click event
// Only use the click to avoid two fired events
$toggle.on($toggle.prop('tagName') === 'A'
? 'click.menu'
: 'click.menu keyup.menu', function(event) {
// prevent the link event (append anchor to URL)
event.preventDefault();
@ -1452,7 +1457,7 @@ function initCore() {
function setupMainMenu() {
// init the more-apps menu
OC.registerMenu($('#more-apps'), $('#navigation'));
OC.registerMenu($('#more-apps > a'), $('#navigation'));
// toggle the navigation
var $toggle = $('#header .header-appname-container');