aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelix Nagel <info@felixnagel.com>2013-03-07 19:15:37 +0100
committerFelix Nagel <info@felixnagel.com>2013-03-07 19:15:37 +0100
commit8787cb045685b93c21c7af6e9ffc6611e679920f (patch)
treef5c1c5a6901e9cefd50cb4abbd3aaf0807db8447
parentdffe8f66109714af2d4ed8f582af4cf3439433e3 (diff)
downloadjquery-ui-8787cb045685b93c21c7af6e9ffc6611e679920f.tar.gz
jquery-ui-8787cb045685b93c21c7af6e9ffc6611e679920f.zip
Selectmenu: switch from a to button element
-rw-r--r--themes/base/jquery.ui.selectmenu.css2
-rw-r--r--ui/jquery.ui.selectmenu.js20
2 files changed, 10 insertions, 12 deletions
diff --git a/themes/base/jquery.ui.selectmenu.css b/themes/base/jquery.ui.selectmenu.css
index 264dfe0bf..3256025a0 100644
--- a/themes/base/jquery.ui.selectmenu.css
+++ b/themes/base/jquery.ui.selectmenu.css
@@ -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;
diff --git a/ui/jquery.ui.selectmenu.js b/ui/jquery.ui.selectmenu.js
index 9132604de..568c2e983 100644
--- a/ui/jquery.ui.selectmenu.js
+++ b/ui/jquery.ui.selectmenu.js
@@ -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;