File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -99,11 +99,14 @@ module.exports = React.createClass({
9999handleKeyDown : function ( e ) {
100100if ( isTabNode ( e . target ) ) {
101101var index = this . getSelectedIndex ( ) ,
102- max = this . getTabs ( ) . length - 1 ;
102+ max = this . getTabs ( ) . length - 1 ,
103+ preventDefault = false ;
103104
104105// Select next tab to the left
105106if ( e . keyCode === 37 || e . keyCode === 38 ) {
106107index -= 1 ;
108+ preventDefault = true ;
109+
107110// Wrap back to last tab if index is negative
108111if ( index < 0 ) {
109112index = max ;
@@ -112,12 +115,19 @@ module.exports = React.createClass({
112115// Select next tab to the right
113116else if ( e . keyCode === 39 || e . keyCode === 40 ) {
114117index += 1 ;
118+ preventDefault = true ;
119+
115120// Wrap back to first tab if index exceeds max
116121if ( index > max ) {
117122index = 0 ;
118123}
119124}
120125
126+ // This prevents scrollbars from moving around
127+ if ( preventDefault ) {
128+ e . preventDefault ( ) ;
129+ }
130+
121131this . setSelected ( index , true ) ;
122132}
123133} ,
You can’t perform that action at this time.
0 commit comments