File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -126,6 +126,22 @@ export default class Picker extends Component {
126
126
this . focus ( ) ;
127
127
}
128
128
129
+ onTab = ( toPrevious ) => {
130
+ this . setOpen ( false ) ;
131
+
132
+ const allInputs = document . querySelectorAll ( 'input' ) ;
133
+ for ( let i = 0 ; i < allInputs . length ; i ++ ) {
134
+ if ( allInputs [ i ] === this . picker ) {
135
+ if ( toPrevious === true && i !== 0 ) {
136
+ allInputs [ i - 1 ] . focus ( ) ;
137
+ } else if ( i !== allInputs . length - 1 ) {
138
+ allInputs [ i + 1 ] . focus ( ) ;
139
+ }
140
+ break ;
141
+ }
142
+ }
143
+ }
144
+
129
145
onKeyDown = ( e ) => {
130
146
if ( e . keyCode === 40 ) {
131
147
this . setOpen ( true ) ;
@@ -184,6 +200,7 @@ export default class Picker extends Component {
184
200
showMinute = { showMinute }
185
201
showSecond = { showSecond }
186
202
onEsc = { this . onEsc }
203
+ onTab = { this . onTab }
187
204
allowEmpty = { allowEmpty }
188
205
format = { this . getFormat ( ) }
189
206
placeholder = { placeholder }
You can’t perform that action at this time.
0 commit comments