Skip to content
This repository was archived by the owner on Sep 22, 2022. It is now read-only.

Commit 85b802c

Browse files
committed
Move visibility checks in to visible()
1 parent da7d257 commit 85b802c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ function keydown(event: KeyboardEvent): void {
3232
}
3333

3434
function focusable(el: Focusable): boolean {
35-
return el.tabIndex >= 0 && !el.disabled && !el.hidden && (!el.type || el.type !== 'hidden') && visible(el)
35+
return el.tabIndex >= 0 && !el.disabled && visible(el)
3636
}
3737

3838
function visible(el): boolean {
39-
return el.offsetWidth > 0 || el.offsetHeight > 0
39+
return !el.hidden && (!el.type || el.type !== 'hidden') && (el.offsetWidth > 0 || el.offsetHeight > 0)
4040
}
4141

4242
function restrictTabBehavior(event: KeyboardEvent): void {

0 commit comments

Comments
 (0)