From 7856b264a297d78762f599611580804b92afd1c0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jo=CC=88rn=20Zaefferer?= Date: Wed, 13 Jul 2011 11:03:25 -0400 Subject: [PATCH] Menubar: Trigger select event after running all other methods. Allows the select-handler to destroy the widget without errors. --- demos/menubar/default.html | 14 ++++++++------ ui/jquery.ui.menubar.js | 6 +++--- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/demos/menubar/default.html b/demos/menubar/default.html index 6bd67b64a..adee4afc9 100644 --- a/demos/menubar/default.html +++ b/demos/menubar/default.html @@ -13,13 +13,17 @@ diff --git a/ui/jquery.ui.menubar.js b/ui/jquery.ui.menubar.js index 3df6d9a53..e28ea3e3c 100644 --- a/ui/jquery.ui.menubar.js +++ b/ui/jquery.ui.menubar.js @@ -49,10 +49,10 @@ $.widget( "ui.menubar", { }, select: function( event, ui ) { ui.item.parents( "ul.ui-menu:last" ).hide(); - that._trigger( "select", event, ui ); that._close(); // TODO what is this targetting? there's probably a better way to access it $(event.target).prev().focus(); + that._trigger( "select", event, ui ); } }) .hide() @@ -94,7 +94,7 @@ $.widget( "ui.menubar", { if( that.options.autoExpand ) { clearTimeout( that.timer ); } - + that._open( event, menu ); } }) @@ -120,7 +120,7 @@ $.widget( "ui.menubar", { .attr( "role", "menuitem" ) .attr( "aria-haspopup", "true" ) .wrapInner( "" ); - + if ( that.options.autoExpand ) { input.bind( "mouseleave.menubar", function( event ) { that.timer = setTimeout( function() { -- 2.39.5