Skip to content

Commit 908fea5

Browse files
author
Steven G. Harms
committed
menubar: mark active menuItem with .ui-state-focus
1 parent 1af1f8c commit 908fea5

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

ui/jquery.ui.menubar.js

+13
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,8 @@ $.widget( "ui.menubar", {
176176
this._hoverable( this.items );
177177
this._applyDOMPropertiesOnItem( $anItem, menubar);
178178

179+
this.__applyMouseAndKeyboardBehaviorForMenuItem ( $anItem, menubar );
180+
179181
if ( menuItemHasSubMenu ) {
180182
this.__applyMouseBehaviorForSubmenuHavingMenuItem( $anItem, menubar );
181183
this.__applyKeyboardBehaviorForSubmenuHavingMenuItem( $anItem, menubar );
@@ -192,6 +194,17 @@ $.widget( "ui.menubar", {
192194
}
193195
},
194196

197+
__applyMouseAndKeyboardBehaviorForMenuItem: function( $anItem, menubar ) {
198+
menubar._on( $anItem, {
199+
focus: function( event ){
200+
$anItem.closest( this.options.items ).addClass("ui-state-focus");
201+
},
202+
focusout: function( event ){
203+
$anItem.closest( this.options.items ).removeClass("ui-state-focus");
204+
}
205+
} );
206+
},
207+
195208
_applyDOMPropertiesOnItem: function( $item, menubar) {
196209
$item
197210
.addClass("ui-button ui-widget ui-button-text-only ui-menubar-link")

0 commit comments

Comments
 (0)