JS: Close menu correctly after searching on iOS

fixes #2922
This commit is contained in:
Florian Strohmaier 2017-09-21 17:52:51 +02:00
parent 632de33035
commit aab32214d6
1 changed files with 4 additions and 2 deletions

View File

@ -533,8 +533,10 @@
* @param {object} e Event * @param {object} e Event
*/ */
closeMobileMenu: function(e) { closeMobileMenu: function(e) {
if (e.which === 13) { var $search = $('#search');
if (e.which === 13 && $search.is(':focus')) {
$('#sidebar').removeClass('expanded'); $('#sidebar').removeClass('expanded');
$search.blur();
} }
}, },
@ -601,7 +603,7 @@
.prepend( .prepend(
$('<div id="mobile-menu-toggle"><button><i class="icon-menu"></i></button></div>') $('<div id="mobile-menu-toggle"><button><i class="icon-menu"></i></button></div>')
); );
$search.on('keypress', this.closeMobileMenu); $(window).on('keypress', this.closeMobileMenu);
this.mobileMenu = true; this.mobileMenu = true;
} }