aboutsummaryrefslogtreecommitdiffstats
path: root/ui/jquery.ui.spinner.js
diff options
context:
space:
mode:
authorScott González <scott.gonzalez@gmail.com>2011-08-06 15:07:34 -0400
committerScott González <scott.gonzalez@gmail.com>2011-08-06 15:07:34 -0400
commit64cdaa82e6736c4b06f6a37ef790820b22d706ed (patch)
tree4dc8d3afea0c2a97eb3c33fd1dd916dd5878e993 /ui/jquery.ui.spinner.js
parentfb5cad37ceb37418d39e1dc1bacceb6ca6413563 (diff)
downloadjquery-ui-64cdaa82e6736c4b06f6a37ef790820b22d706ed.tar.gz
jquery-ui-64cdaa82e6736c4b06f6a37ef790820b22d706ed.zip
Spinner: Keep the focus on the text field even when using the buttons.
Diffstat (limited to 'ui/jquery.ui.spinner.js')
-rw-r--r--ui/jquery.ui.spinner.js10
1 files changed, 7 insertions, 3 deletions
diff --git a/ui/jquery.ui.spinner.js b/ui/jquery.ui.spinner.js
index baa3fb5cb..2add2d60a 100644
--- a/ui/jquery.ui.spinner.js
+++ b/ui/jquery.ui.spinner.js
@@ -62,9 +62,7 @@ $.widget( "ui.spinner", {
.wrap( this._uiSpinnerHtml() )
.parent()
// add buttons
- .append( this._buttonHtml() )
- // add behaviors
- .disableSelection();
+ .append( this._buttonHtml() );
this._hoverable( uiSpinner );
this.element.attr( "role", "spinbutton" );
@@ -108,6 +106,12 @@ $.widget( "ui.spinner", {
.removeClass( "ui-corner-all" );
this._bind( this.buttons, {
mousedown: function( event ) {
+ // ensure focus is on (or stays on) the text field
+ event.preventDefault();
+ if ( document.activeElement !== this.element[ 0 ] ) {
+ this.element.focus();
+ }
+
if ( this._start( event ) === false ) {
return;
}