Permalink
Browse files

Selectmenu: switch from a to button element

  • Loading branch information...
1 parent dffe8f6 commit 8787cb045685b93c21c7af6e9ffc6611e679920f @fnagel fnagel committed Mar 7, 2013
Showing with 10 additions and 12 deletions.
  1. +1 −1 themes/base/jquery.ui.selectmenu.css
  2. +9 −11 ui/jquery.ui.selectmenu.js
@@ -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;
View
@@ -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;

0 comments on commit 8787cb0

Please sign in to comment.