mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Selectmenu: switch from a to button element
This commit is contained in:
parent
dffe8f6610
commit
8787cb0456
2
themes/base/jquery.ui.selectmenu.css
vendored
2
themes/base/jquery.ui.selectmenu.css
vendored
@ -35,7 +35,7 @@
|
||||
.ui-selectmenu-open {
|
||||
display: block;
|
||||
}
|
||||
.ui-selectmenu-button a.ui-button {
|
||||
.ui-selectmenu-button .ui-button {
|
||||
display: inline-block;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
|
20
ui/jquery.ui.selectmenu.js
vendored
20
ui/jquery.ui.selectmenu.js
vendored
@ -68,9 +68,8 @@ $.widget( "ui.selectmenu", {
|
||||
this.element.hide();
|
||||
|
||||
// create button
|
||||
this.button = $( "<a>", {
|
||||
this.button = $( "<button>", {
|
||||
"class": "ui-button ui-widget ui-state-default ui-corner-all",
|
||||
href: "#" + this.ids.id,
|
||||
tabindex: ( tabindex ? tabindex : this.options.disabled ? -1 : 0 ),
|
||||
id: this.ids.button,
|
||||
width: this.element.outerWidth(),
|
||||
@ -294,8 +293,12 @@ $.widget( "ui.selectmenu", {
|
||||
this.button.addClass( "ui-state-focus" );
|
||||
this._off( this.button, "focus" );
|
||||
},
|
||||
click: function( event ) {
|
||||
this._toggle( event );
|
||||
click: function( event ) {
|
||||
if ( this.isOpen ) {
|
||||
this.menu.menu( "select", event );
|
||||
} else {
|
||||
this._toggle( event );
|
||||
}
|
||||
event.preventDefault();
|
||||
},
|
||||
keydown: function( event ) {
|
||||
@ -327,13 +330,6 @@ $.widget( "ui.selectmenu", {
|
||||
this._move( "next", event );
|
||||
}
|
||||
break;
|
||||
case $.ui.keyCode.SPACE:
|
||||
if ( this.isOpen ) {
|
||||
this.menu.menu( "select", event );
|
||||
} else {
|
||||
this._toggle( event );
|
||||
}
|
||||
break;
|
||||
case $.ui.keyCode.LEFT:
|
||||
this._move( "previous", event );
|
||||
break;
|
||||
@ -348,6 +344,8 @@ $.widget( "ui.selectmenu", {
|
||||
case $.ui.keyCode.PAGE_DOWN:
|
||||
this._move( "last", event );
|
||||
break;
|
||||
case $.ui.keyCode.SPACE:
|
||||
break;
|
||||
default:
|
||||
this.menu.trigger( event );
|
||||
prevDef = false;
|
||||
|
Loading…
Reference in New Issue
Block a user