mirror of
https://github.com/jquery/jquery-ui.git
synced 2025-01-07 20:34:24 +00:00
Menu: Prevent clicking on disabled menu items and remove unnecessary extra padding from disabled items.
This commit is contained in:
parent
4259978d39
commit
48ad0994a0
@ -76,12 +76,12 @@
|
||||
<ul id="menu2">
|
||||
<li><a href="#">Aberdeen</a></li>
|
||||
<li><a href="#">Ada</a></li>
|
||||
<li><a href="#">Adamsville</a></li>
|
||||
<li class="ui-state-disabled"><a href="#">Adamsville</a></li>
|
||||
<li><a href="#">Addyston</a></li>
|
||||
<li>
|
||||
<a href="#">Delphi</a>
|
||||
<ul>
|
||||
<li><a href="#">Ada</a></li>
|
||||
<li class="ui-state-disabled"><a href="#">Ada</a></li>
|
||||
<li><a href="#">Saarland</a></li>
|
||||
<li><a href="#">Salzburg</a></li>
|
||||
</ul>
|
||||
@ -113,7 +113,7 @@
|
||||
|
||||
<ul id="menu3">
|
||||
<li><a href="#"><span class="ui-icon ui-icon-print"></span>Aberdeen</a></li>
|
||||
<li><a href="#"><span class="ui-icon ui-icon-scissors"></span>Ada</a></li>
|
||||
<li class="ui-state-disabled"><a href="#"><span class="ui-icon ui-icon-scissors"></span>Ada</a></li>
|
||||
<li><a href="#">Adamsville</a></li>
|
||||
<li><a href="#"><span class="ui-icon ui-icon-wrench"></span>Addyston</a></li>
|
||||
<li>
|
||||
@ -193,7 +193,7 @@
|
||||
<div id="menu5">
|
||||
<blockquote><a href="#">Aberdeen</a></blockquote>
|
||||
<blockquote><a href="#">Ada</a></blockquote>
|
||||
<blockquote><a href="#">Adamsville</a></blockquote>
|
||||
<blockquote class="ui-state-disabled"><a href="#">Adamsville</a></blockquote>
|
||||
<blockquote><a href="#">Addyston</a></blockquote>
|
||||
<blockquote>
|
||||
<a href="#">Delphi</a>
|
||||
@ -243,7 +243,7 @@
|
||||
<span class="address-content">Bloomsburg, PA 12345</span>
|
||||
</a>
|
||||
</div>
|
||||
<div class="address-item">
|
||||
<div class="address-item ui-state-disabled">
|
||||
<a href="#">
|
||||
<span class="address-header">James Doe</span>
|
||||
<span class="address-content">78 West Main St Apt 3A</span>
|
||||
|
2
themes/base/jquery.ui.menu.css
vendored
2
themes/base/jquery.ui.menu.css
vendored
@ -14,7 +14,7 @@
|
||||
.ui-menu .ui-menu-item a.ui-state-focus,
|
||||
.ui-menu .ui-menu-item a.ui-state-active { font-weight: normal; margin: -1px; }
|
||||
|
||||
.ui-menu .ui-state-disabled { font-weight: normal; padding: .0em .4em; margin: .4em 0 .2em; line-height: 1.5; }
|
||||
.ui-menu .ui-state-disabled { font-weight: normal; margin: .4em 0 .2em; line-height: 1.5; }
|
||||
|
||||
/* icon support */
|
||||
.ui-menu-icons { position: relative; }
|
||||
|
18
ui/jquery.ui.menu.js
vendored
18
ui/jquery.ui.menu.js
vendored
@ -56,13 +56,17 @@ $.widget( "ui.menu", {
|
||||
},
|
||||
"click .ui-menu-item:has(a)": function( event ) {
|
||||
event.stopImmediatePropagation();
|
||||
this.select( event );
|
||||
// Redirect focus to the menu with a delay for firefox
|
||||
this._delay( function() {
|
||||
if ( !this.element.is(":focus") ) {
|
||||
this.element.focus();
|
||||
}
|
||||
}, 20);
|
||||
//Don't select disabled menu items
|
||||
if ( !$( event.target ).closest( ".ui-menu-item" ).is( ".ui-state-disabled" ) ) {
|
||||
console.log(event.target);
|
||||
this.select( event );
|
||||
// Redirect focus to the menu with a delay for firefox
|
||||
this._delay( function() {
|
||||
if ( !this.element.is(":focus") ) {
|
||||
this.element.focus();
|
||||
}
|
||||
}, 20);
|
||||
}
|
||||
},
|
||||
"mouseover .ui-menu-item": function( event ) {
|
||||
event.stopImmediatePropagation();
|
||||
|
Loading…
Reference in New Issue
Block a user