aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelix Nagel <info@felixnagel.com>2011-10-05 00:45:53 +0200
committerFelix Nagel <info@felixnagel.com>2011-10-05 00:45:53 +0200
commit30ac35afb12bb614dd963c9ab912693faaeb927e (patch)
treed8f23da280291aa7321994d7bb76fe663229323b
parent0f04a5bb5ca57864726b4b0dd7d386335e4e38f0 (diff)
downloadjquery-ui-30ac35afb12bb614dd963c9ab912693faaeb927e.tar.gz
jquery-ui-30ac35afb12bb614dd963c9ab912693faaeb927e.zip
Selectmenu: fixed ENTER event on closed button, fixed demo events.html
-rw-r--r--tests/visual/selectmenu/events.html1
-rw-r--r--ui/jquery.ui.selectmenu.js11
2 files changed, 7 insertions, 5 deletions
diff --git a/tests/visual/selectmenu/events.html b/tests/visual/selectmenu/events.html
index 8c4da5fb1..02c58db3c 100644
--- a/tests/visual/selectmenu/events.html
+++ b/tests/visual/selectmenu/events.html
@@ -62,6 +62,7 @@
<option value="Fast">Fast</option>
<option value="Faster">Faster</option>
</select>
+ </fieldset>
</form>
</div><!-- End demo -->
diff --git a/ui/jquery.ui.selectmenu.js b/ui/jquery.ui.selectmenu.js
index 3b6f84946..50f1264e5 100644
--- a/ui/jquery.ui.selectmenu.js
+++ b/ui/jquery.ui.selectmenu.js
@@ -333,7 +333,7 @@ $.widget( "ui.selectmenu", {
event.stopImmediatePropagation();
},
click: function( event ) {
- // needed to prevent browser from following the anchor
+ // return false needed to prevent browser from following the anchor
return false;
},
keydown: function( event ) {
@@ -342,8 +342,10 @@ $.widget( "ui.selectmenu", {
if ( this.opened ) this.close();
break;
case $.ui.keyCode.ENTER:
- if ( this.opened ) this.list.menu( "select", this._getSelectedItem() );
- event.preventDefault();
+ if ( this.opened ) {
+ this.list.menu( "select", this._getSelectedItem() );
+ event.preventDefault();
+ }
break;
case $.ui.keyCode.SPACE:
this._toggle(event);
@@ -377,8 +379,7 @@ $.widget( "ui.selectmenu", {
this.list.trigger( event );
}
}
- },
-
+ },
_setOption: function( key, value ) {
this._super( "_setOption", key, value );