File tree Expand file tree Collapse file tree 2 files changed +6
-12
lines changed Expand file tree Collapse file tree 2 files changed +6
-12
lines changed Original file line number Diff line number Diff line change @@ -153,27 +153,24 @@ class Toolbar extends Module<ToolbarProps> {
153
153
var target = e . currentTarget ;
154
154
if ( ! target ) return ;
155
155
156
- switch ( e . key ) {
157
- case 'ArrowLeft' :
158
- case 'ArrowRight' :
156
+ if ( e . key === 'ArrowLeft' || e . key === 'ArrowRight' ) {
159
157
this . updateTabIndexes ( target , e . key ) ;
160
- break ;
161
- }
158
+ }
162
159
}
163
160
164
161
updateTabIndexes ( target : EventTarget , key : string ) {
165
162
const currentIndex = this . controls . findIndex ( control => control [ 1 ] === target ) ;
166
163
const currentItem = this . controls [ currentIndex ] [ 1 ] ;
167
164
currentItem . tabIndex = - 1 ;
168
165
169
- let nextIndex ;
166
+ let nextIndex : number | null = null ;
170
167
if ( key === 'ArrowLeft' ) {
171
168
nextIndex = currentIndex === 0 ? this . controls . length - 1 : currentIndex - 1 ;
172
169
} else if ( key === 'ArrowRight' ) {
173
170
nextIndex = currentIndex === this . controls . length - 1 ? 0 : currentIndex + 1 ;
174
171
}
175
172
176
- if ( nextIndex === undefined ) return ;
173
+ if ( nextIndex === null ) return ;
177
174
const nextItem = this . controls [ nextIndex ] [ 1 ] ;
178
175
if ( nextItem . tagName === 'SELECT' ) {
179
176
const qlPickerLabel = nextItem . previousElementSibling ?. querySelectorAll ( '.ql-picker-label' ) [ 0 ] ;
Original file line number Diff line number Diff line change @@ -129,12 +129,9 @@ class Picker {
129
129
var target = e . currentTarget ;
130
130
if ( ! target ) return ;
131
131
132
- switch ( e . key ) {
133
- case 'ArrowLeft' :
134
- case 'ArrowRight' :
132
+ if ( e . key === 'ArrowLeft' || e . key === 'ArrowRight' ) {
135
133
this . updateTabIndexes ( target , e . key ) ;
136
- break ;
137
- }
134
+ }
138
135
}
139
136
140
137
updateTabIndexes ( target : EventTarget , key : string ) {
You can’t perform that action at this time.
0 commit comments