File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -278,16 +278,17 @@ function focusKeydown(event: KeyboardEvent) {
278
278
if ( ! ( toolbar instanceof HTMLElement ) ) return
279
279
const buttons = getButtons ( toolbar )
280
280
const index = buttons . indexOf ( event . target )
281
+ const length = buttons . length
281
282
if ( index === - 1 ) return
282
283
283
284
let n = 0
284
285
if ( key === 'ArrowLeft' ) n = index - 1
285
286
if ( key === 'ArrowRight' ) n = index + 1
286
- if ( key === 'End' ) n = buttons . length - 1
287
- if ( n < 0 ) n = buttons . length - 1
288
- if ( n > buttons . length - 1 ) n = 0
287
+ if ( key === 'End' ) n = length - 1
288
+ if ( n < 0 ) n = length - 1
289
+ if ( n > length - 1 ) n = 0
289
290
290
- for ( let i = 0 ; i < buttons . length ; i += 1 ) {
291
+ for ( let i = 0 ; i < length ; i += 1 ) {
291
292
buttons [ i ] . setAttribute ( 'tabindex' , i === n ? '0' : '-1' )
292
293
if ( i === n ) {
293
294
buttons [ i ] . focus ( )
You can’t perform that action at this time.
0 commit comments