Skip to content

Commit 4a79ecc

Browse files
committed
Ignore hidden options
1 parent 0cc8367 commit 4a79ecc

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/combobox-nav.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,8 @@ export function navigate(
9090
list: HTMLElement,
9191
indexDiff: -1 | 1 = 1
9292
): void {
93-
const focusEl = list.querySelector('[aria-selected="true"]')
94-
const els = Array.from(list.querySelectorAll('[role="option"]'))
93+
const focusEl = list.querySelector('[aria-selected="true"]:not([hidden])')
94+
const els = Array.from(list.querySelectorAll('[role="option"]:not([hidden])'))
9595
const focusIndex = els.indexOf(focusEl)
9696
let indexOfItem = indexDiff === 1 ? 0 : els.length - 1
9797
if (focusEl && focusIndex >= 0) {

0 commit comments

Comments
 (0)