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 {
7777 if ( this . defaultFirstOption ) {
7878 Array . from ( this . list . querySelectorAll < HTMLElement > ( '[role="option"]:not([aria-disabled="true"])' ) )
7979 . filter ( visible ) [ 0 ]
80- . setAttribute ( 'data-combobox-option-default' , 'true' )
80+ ? .setAttribute ( 'data-combobox-option-default' , 'true' )
8181 }
8282 }
8383
Original file line number Diff line number Diff line change @@ -288,5 +288,12 @@ describe('combobox-nav', function () {
288288 combobox . clearSelection ( )
289289 assert . equal ( document . querySelectorAll ( '[data-combobox-option-default]' ) . length , 1 )
290290 } )
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+ } )
291298 } )
292299} )
You can’t perform that action at this time.
0 commit comments