Skip to content

Commit

Permalink
Slider: Switch handles from <a href="#"> to <span tabindex="0">
Browse files Browse the repository at this point in the history
Fixes #9890
Closes gh-1207
  • Loading branch information
tjvantoll committed Mar 7, 2014
1 parent 343c265 commit dfc5c34
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
2 changes: 1 addition & 1 deletion demos/slider/multiple-vertical.html
Expand Up @@ -11,7 +11,7 @@
<script src="../../ui/slider.js"></script> <script src="../../ui/slider.js"></script>
<link rel="stylesheet" href="../demos.css"> <link rel="stylesheet" href="../demos.css">
<style> <style>
#eq span { #eq > span {
height:120px; float:left; margin:15px height:120px; float:left; margin:15px
} }
</style> </style>
Expand Down
14 changes: 5 additions & 9 deletions ui/slider.js
Expand Up @@ -83,7 +83,7 @@ return $.widget( "ui.slider", $.ui.mouse, {
var i, handleCount, var i, handleCount,
options = this.options, options = this.options,
existingHandles = this.element.find( ".ui-slider-handle" ).addClass( "ui-state-default ui-corner-all" ), existingHandles = this.element.find( ".ui-slider-handle" ).addClass( "ui-state-default ui-corner-all" ),
handle = "<a class='ui-slider-handle ui-state-default ui-corner-all' href='#'></a>", handle = "<span class='ui-slider-handle ui-state-default ui-corner-all' tabindex='0'></span>",
handles = []; handles = [];


handleCount = ( options.values && options.values.length ) || 1; handleCount = ( options.values && options.values.length ) || 1;
Expand Down Expand Up @@ -149,11 +149,10 @@ return $.widget( "ui.slider", $.ui.mouse, {
}, },


_setupEvents: function() { _setupEvents: function() {
var elements = this.handles.add( this.range ).filter( "a" ); this._off( this.handles );
this._off( elements ); this._on( this.handles, this._handleEvents );
this._on( elements, this._handleEvents ); this._hoverable( this.handles );
this._hoverable( elements ); this._focusable( this.handles );
this._focusable( elements );
}, },


_destroy: function() { _destroy: function() {
Expand Down Expand Up @@ -673,9 +672,6 @@ return $.widget( "ui.slider", $.ui.mouse, {


this._slide( event, index, newVal ); this._slide( event, index, newVal );
}, },
click: function( event ) {
event.preventDefault();
},
keyup: function( event ) { keyup: function( event ) {
var index = $( event.target ).data( "ui-slider-handle-index" ); var index = $( event.target ).data( "ui-slider-handle-index" );


Expand Down

0 comments on commit dfc5c34

Please sign in to comment.