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) {
278278 if ( ! ( toolbar instanceof HTMLElement ) ) return
279279 const buttons = getButtons ( toolbar )
280280 const index = buttons . indexOf ( event . target )
281+ const length = buttons . length
281282 if ( index === - 1 ) return
282283
283284 let n = 0
284285 if ( key === 'ArrowLeft' ) n = index - 1
285286 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
289290
290- for ( let i = 0 ; i < buttons . length ; i += 1 ) {
291+ for ( let i = 0 ; i < length ; i += 1 ) {
291292 buttons [ i ] . setAttribute ( 'tabindex' , i === n ? '0' : '-1' )
292293 if ( i === n ) {
293294 buttons [ i ] . focus ( )
You can’t perform that action at this time.
0 commit comments