From 485e0a06121d712bccad82a21a9e443292d2f9bb Mon Sep 17 00:00:00 2001 From: Kris Borchers Date: Mon, 26 Aug 2013 00:06:44 -0500 Subject: Menu: Only focus menu after click if focus is on an element within menu. Fixes #9044 - Menu: Autofocus issue with dialog opened from menu widget --- ui/jquery.ui.menu.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'ui') diff --git a/ui/jquery.ui.menu.js b/ui/jquery.ui.menu.js index 3352eb8bd..272ab7bf4 100644 --- a/ui/jquery.ui.menu.js +++ b/ui/jquery.ui.menu.js @@ -85,7 +85,8 @@ $.widget( "ui.menu", { // Open submenu on click if ( target.has( ".ui-menu" ).length ) { this.expand( event ); - } else if ( !this.element.is( ":focus" ) ) { + } else if ( !this.element.is( ":focus" ) && $( this.document[ 0 ].activeElement ).closest( ".ui-menu" ).length ) { + // Redirect focus to the menu this.element.trigger( "focus", [ true ] ); -- cgit v1.2.3