Skip to content

Commit

Permalink
Ignore hidden options
Browse files Browse the repository at this point in the history
  • Loading branch information
muan committed Dec 4, 2019
1 parent 0cc8367 commit 4a79ecc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/combobox-nav.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ export function navigate(
list: HTMLElement,
indexDiff: -1 | 1 = 1
): void {
const focusEl = list.querySelector('[aria-selected="true"]')
const els = Array.from(list.querySelectorAll('[role="option"]'))
const focusEl = list.querySelector('[aria-selected="true"]:not([hidden])')
const els = Array.from(list.querySelectorAll('[role="option"]:not([hidden])'))
const focusIndex = els.indexOf(focusEl)
let indexOfItem = indexDiff === 1 ? 0 : els.length - 1
if (focusEl && focusIndex >= 0) {
Expand Down

0 comments on commit 4a79ecc

Please sign in to comment.