@@ -69,6 +69,7 @@ class PfeAutocomplete extends PFElement {
6969 search : `${ this . tag } :search-event` ,
7070 select : `${ this . tag } :option-selected` ,
7171 optionsShown : `${ this . tag } :options-shown` ,
72+ optionCleared : `${ this . tag } :option-cleared` ,
7273 slotchange : `slotchange` ,
7374 } ;
7475 }
@@ -129,6 +130,7 @@ class PfeAutocomplete extends PFElement {
129130
130131 this . _input . addEventListener ( "input" , this . _inputChanged . bind ( this ) ) ;
131132 this . _input . addEventListener ( "blur" , this . _closeDroplist . bind ( this ) ) ;
133+ this . _input . addEventListener ( "search" , this . _searchCleared . bind ( this ) ) ;
132134
133135 this . _input . setAttribute ( "role" , "combobox" ) ;
134136
@@ -254,6 +256,7 @@ class PfeAutocomplete extends PFElement {
254256 this . _searchBtn . setAttribute ( "disabled" , "" ) ;
255257 this . _searchBtnTextual . setAttribute ( "disabled" , "" ) ;
256258 this . _input . focus ( ) ;
259+ this . _searchCleared ( ) ;
257260 }
258261
259262 _search ( ) {
@@ -266,6 +269,14 @@ class PfeAutocomplete extends PFElement {
266269 this . _input . setAttribute ( "aria-expanded" , "false" ) ;
267270 }
268271
272+ _searchCleared ( ) {
273+ this . emitEvent ( PfeAutocomplete . events . optionsShown , {
274+ bubbles : true ,
275+ composed : true ,
276+ detail : { searchValue : searchQuery }
277+ } ) ;
278+ }
279+
269280 _openDroplist ( ) {
270281 this . activeIndex = null ;
271282 this . _dropdown . open = true ;
@@ -412,6 +423,7 @@ class PfeAutocomplete extends PFElement {
412423* pfe-autocomplete:option-selected | Fires when an option is selected.
413424 event.details.optionValue contains the selected value.
414425*/
426+
415427class PfeSearchDroplist extends PFElement {
416428 static get tag ( ) {
417429 return "pfe-search-droplist" ;
0 commit comments