@@ -525,39 +525,19 @@ export class ComboboxController<
525525 }
526526
527527 #filterItems( ) {
528- if ( ! this . #input) {
529- return ;
530- }
531- const value = this . options . getComboboxValue ( this . #input) ;
532- let filteredOption = 0 ;
533- for ( const item of this . items ) {
534- const isExpanded = this . options . isExpanded ?.( ) ?? false ;
535- const matchesFilter = this . options . isItemFiltered ?.( item , value ) ?? false ;
536- // Increment the filtered option list count by 1 to limit the no of options shown
537- if ( ! isExpanded || ! matchesFilter ) {
538- filteredOption ++ ;
528+ if ( this . #input) {
529+ let value : string ;
530+ for ( const item of this . items ) {
531+ const hidden =
532+ ! ! this . options . isExpanded ( )
533+ && ! ! ( value = this . options . getComboboxValue ( this . #input) )
534+ && this . options . isItemFiltered ?.( item , value )
535+ || false ;
536+ this . options . setItemHidden ( item , hidden ) ;
539537 }
540- // Determine if the item should be hidden
541- const hidden = ( isExpanded && matchesFilter ) || filteredOption > 5 ;
542- this . options . setItemHidden ( item , hidden ) ;
543538 }
544539 }
545540
546- // Commented the actual function for filter and will be uncommenting this
547- // #filterItems() {
548- // if (this.#input) {
549- // let value: string;
550- // for (const item of this.items) {
551- // const hidden =
552- // !!this.options.isExpanded()
553- // && !!(value = this.options.getComboboxValue(this.#input))
554- // && this.options.isItemFiltered?.(item, value)
555- // || false;
556- // this.options.setItemHidden(item, hidden);
557- // }
558- // }
559- // }
560-
561541 #onClickButton = ( ) => {
562542 if ( ! this . options . isExpanded ( ) ) {
563543 this . #show( ) ;
0 commit comments