Skip to content

Commit 7fef62f

Browse files
committed
refactor: move needless if condition out of loop
1 parent f1bfaba commit 7fef62f

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

index.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -290,10 +290,9 @@ function focusKeydown(event: KeyboardEvent) {
290290

291291
for (let i = 0; i < length; i += 1) {
292292
buttons[i].setAttribute('tabindex', i === n ? '0' : '-1')
293-
if (i === n) {
294-
buttons[i].focus()
295-
}
296293
}
294+
295+
buttons[n].focus()
297296
}
298297

299298
const shortcutListeners = new WeakMap()

0 commit comments

Comments
 (0)