Skip to content

Commit

Permalink
Merge pull request #1206 from NateWr/i2085_touch_nav
Browse files Browse the repository at this point in the history
pkp/pkp-lib#2085 Improve touch controls of frontend nav dropdowns
  • Loading branch information
bozana authored Jan 25, 2017
2 parents 181e2f0 + 7aaea3b commit 614f8f9
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion plugins/themes/default/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,24 @@
});

$('.navDropdownMenu ul').on('blur.default mouseleave.default', '[aria-haspopup="true"]', function (e) {
$(e.currentTarget).attr('aria-expanded', false);
$(e.currentTarget).attr('aria-expanded', false)
.attr('pkp-touch-state', '');
});

// Taps on nav menu items with submenus should expand on first tap
$('.navDropdownMenu a').on('touchstart', function(e) {
var target = $(e.target),
li = target.parent('li');
if (li.length && li.attr('aria-haspopup')) {
var state = li.attr('pkp-touch-state') || '';
if (state != 'open') {
target.trigger('focus.default');
li.attr('pkp-touch-state', 'open');
e.preventDefault();
}
}
})

// Register click handlers for the search panel
var headerSearchPanelIsClosing = false,
headerSearchForm = $('#headerNavigationContainer .pkp_search'),
Expand Down

0 comments on commit 614f8f9

Please sign in to comment.