File tree Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Expand file tree Collapse file tree 2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -77,7 +77,7 @@ export default class Combobox {
77
77
if ( this . defaultFirstOption ) {
78
78
Array . from ( this . list . querySelectorAll < HTMLElement > ( '[role="option"]:not([aria-disabled="true"])' ) )
79
79
. filter ( visible ) [ 0 ]
80
- . setAttribute ( 'data-combobox-option-default' , 'true' )
80
+ ? .setAttribute ( 'data-combobox-option-default' , 'true' )
81
81
}
82
82
}
83
83
Original file line number Diff line number Diff line change @@ -288,5 +288,12 @@ describe('combobox-nav', function () {
288
288
combobox . clearSelection ( )
289
289
assert . equal ( document . querySelectorAll ( '[data-combobox-option-default]' ) . length , 1 )
290
290
} )
291
+
292
+ it ( 'does not error when no options are visible' , ( ) => {
293
+ assert . doesNotThrow ( ( ) => {
294
+ document . getElementById ( 'list-id' ) . style . display = 'none'
295
+ combobox . clearSelection ( )
296
+ } )
297
+ } )
291
298
} )
292
299
} )
You can’t perform that action at this time.
0 commit comments