X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=js%2Fcrm.menubar.js;h=8360557f05daf8b5cb1ea4b7c60b990c0cabeaed;hb=c20b6c4438bc8997e5dd717ec0d8ea0d37f94ba3;hp=a9177bb5b2ced16a5bcff09953e02aa41d9acc2c;hpb=c68afacb4b25b9f2d09b35f6f793daa5a8904600;p=civicrm-core.git diff --git a/js/crm.menubar.js b/js/crm.menubar.js index a9177bb5b2..8360557f05 100644 --- a/js/crm.menubar.js +++ b/js/crm.menubar.js @@ -253,8 +253,10 @@ initializeResponsive: function() { var $mainMenuState = $('#crm-menubar-state'); // hide mobile menu beforeunload - $(window).on('beforeunload unload', function() { - CRM.menubar.spin(true); + $(window).on('beforeunload unload', function(e) { + if (!e.originalEvent.returnValue) { + CRM.menubar.spin(true); + } if ($mainMenuState[0].checked) { $mainMenuState[0].click(); } @@ -314,6 +316,12 @@ }); }, focus: function (event, ui) { + // This is when an item is 'focussed' by keyboard up/down or mouse hover. + // It is not the same as actually having focus, i.e. it is not :focus + var lis = $(event.currentTarget).find('li[data-cid="' + ui.item.value + '"]'); + lis.children('div').addClass('ui-state-active'); + lis.siblings().children('div').removeClass('ui-state-active'); + // Returning false leaves the user-entered text as it was. return false; }, select: function (event, ui) { @@ -340,6 +348,7 @@ .autocomplete( "instance" )._renderItem = function( ul, item ) { var uiMenuItemWrapper = $("
"); if (item.value == 0) { + // "No results" uiMenuItemWrapper.text(item.label); } else { @@ -359,7 +368,7 @@ })); } - return $( "
  • " ) + return $( "
  • " ) .append(uiMenuItemWrapper) .appendTo( ul ); };