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

Commit 0ab41ba

Browse files
committed
Filter focusable autofocus target
1 parent 1d61bff commit 0ab41ba

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ type Focusable =
1212
| HTMLElement
1313

1414
function autofocus(el: DetailsDialogElement): void {
15-
let autofocusElement = el.querySelector('[autofocus]')
15+
let autofocusElement = Array.from(el.querySelectorAll('[autofocus]')).filter(focusable)[0]
1616
if (!autofocusElement) {
1717
autofocusElement = el
1818
el.setAttribute('tabindex', '-1')

0 commit comments

Comments
 (0)