Skip to content

Commit

Permalink
Fix keyboard menu element event detection
Browse files Browse the repository at this point in the history
Signed-off-by: John Molakvoæ (skjnldsv) <[email protected]>
  • Loading branch information
skjnldsv committed Aug 22, 2018
1 parent e0f29ca commit ba66cad
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions core/js/js.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down Expand Up @@ -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');
Expand Down

0 comments on commit ba66cad

Please sign in to comment.