aboutsummaryrefslogtreecommitdiffstats
path: root/ui/jquery.ui.menu.js
diff options
context:
space:
mode:
authorkborchers <kris.borchers@gmail.com>2012-04-16 07:02:28 -0500
committerkborchers <kris.borchers@gmail.com>2012-04-16 07:02:38 -0500
commit9a6392033a0ee2b79999777a5e279e6aa3cfb12a (patch)
tree240c7db609bfd4570a9c992c2fb25ddaaa08d274 /ui/jquery.ui.menu.js
parent6da7278e879c0dc734c23231a71fdd92f7a57a0c (diff)
downloadjquery-ui-9a6392033a0ee2b79999777a5e279e6aa3cfb12a.tar.gz
jquery-ui-9a6392033a0ee2b79999777a5e279e6aa3cfb12a.zip
Menu: Add aria-disabled attribute to disabled items, namespace and cleanup the currentEventTarget click event
Diffstat (limited to 'ui/jquery.ui.menu.js')
-rw-r--r--ui/jquery.ui.menu.js16
1 files changed, 12 insertions, 4 deletions
diff --git a/ui/jquery.ui.menu.js b/ui/jquery.ui.menu.js
index 5e6b335ba..ec7a69754 100644
--- a/ui/jquery.ui.menu.js
+++ b/ui/jquery.ui.menu.js
@@ -14,7 +14,7 @@
(function($) {
var idIncrement = 0,
- currentEventTarget;
+ currentEventTarget = null;
$.widget( "ui.menu", {
version: "@VERSION",
@@ -54,7 +54,9 @@ $.widget( "ui.menu", {
}, this ));
if ( this.options.disabled ) {
- this.element.addClass( "ui-state-disabled" );
+ this.element
+ .addClass( "ui-state-disabled" )
+ .attr( "aria-disabled", "true" );
}
this._bind({
@@ -70,8 +72,8 @@ $.widget( "ui.menu", {
var target = $( event.target );
if ( target[0] != currentEventTarget ) {
currentEventTarget = target[0];
- target.one( "click", function( event ) {
- currentEventTarget = "";
+ target.one( "click.menu", function( event ) {
+ currentEventTarget = null;
});
// Don't select disabled menu items
if ( !target.closest( ".ui-menu-item" ).is( ".ui-state-disabled" ) ) {
@@ -158,6 +160,9 @@ $.widget( "ui.menu", {
.removeAttr( "id" )
.children( ".ui-icon" )
.remove();
+
+ // unbind currentEventTarget click event handler
+ $( currentEventTarget ).unbind( "click.menu" );
},
_keydown: function( event ) {
@@ -282,6 +287,9 @@ $.widget( "ui.menu", {
// initialize unlinked menu-items as dividers
menus.children( ":not(.ui-menu-item)" ).addClass( "ui-widget-content ui-menu-divider" );
+ // add aria-disabled attribut to any disabled menu item
+ menus.children( ".ui-state-disabled" ).attr( "aria-disabled", "true" );
+
submenus.each(function() {
var menu = $( this ),
item = menu.prev( "a" );