File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed
Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -31,10 +31,11 @@ class Dropdown extends React.Component {
3131 return
3232 }
3333 childSelectionIndex += 1
34- if ( childSelectionIndex > listChild . length ) {
35- childSelectionIndex = 0
34+ if ( childSelectionIndex >= listChild . length ) {
35+ childSelectionIndex -= 1
36+ } else {
37+ listChild [ childSelectionIndex ] . focus ( )
3638 }
37- listChild [ childSelectionIndex ] . focus ( )
3839 }
3940 const focusOnPreviousChild = ( ) => {
4041 const listChild = this . listRef . getElementsByTagName ( 'li' )
@@ -43,9 +44,10 @@ class Dropdown extends React.Component {
4344 }
4445 childSelectionIndex -= 1
4546 if ( childSelectionIndex < 0 ) {
46- childSelectionIndex = listChild . length - 1
47+ childSelectionIndex = 0
48+ } else {
49+ listChild [ childSelectionIndex ] . focus ( )
4750 }
48- listChild [ childSelectionIndex ] . focus ( )
4951 }
5052 let searchKey = ''
5153 let timer
You can’t perform that action at this time.
0 commit comments