File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -85,13 +85,17 @@ function fireCommitEvent(target: Element): void {
8585 )
8686}
8787
88+ function visible ( el ) : boolean {
89+ return ! el . hidden && ( ! el . type || el . type !== 'hidden' ) && ( el . offsetWidth > 0 || el . offsetHeight > 0 )
90+ }
91+
8892export function navigate (
8993 input : HTMLTextAreaElement | HTMLInputElement ,
9094 list : HTMLElement ,
9195 indexDiff : - 1 | 1 = 1
9296) : void {
93- const focusEl = list . querySelector ( '[aria-selected="true"]:not([hidden])' )
94- const els = Array . from ( list . querySelectorAll ( '[role="option"]:not([hidden])' ) )
97+ const focusEl = Array . from ( list . querySelectorAll ( '[aria-selected="true"]' ) ) . filter ( visible ) [ 0 ]
98+ const els = Array . from ( list . querySelectorAll ( '[role="option"]' ) ) . filter ( visible )
9599 const focusIndex = els . indexOf ( focusEl )
96100 let indexOfItem = indexDiff === 1 ? 0 : els . length - 1
97101 if ( focusEl && focusIndex >= 0 ) {
You can’t perform that action at this time.
0 commit comments