@@ -599,13 +599,19 @@ export const ComboBoxMixin = (subclass) =>
599599 return event . composedPath ( ) [ 0 ] === this . clearElement ;
600600 }
601601
602+ /** @private */
603+ __onClearButtonMouseDown ( event ) {
604+ event . preventDefault ( ) ; // Prevent native focusout event
605+ this . inputElement . focus ( ) ;
606+ }
607+
602608 /**
603609 * @param {Event } event
604610 * @protected
605611 */
606- _handleClearButtonClick ( event ) {
612+ _onClearButtonClick ( event ) {
607613 event . preventDefault ( ) ;
608- this . _clear ( ) ;
614+ this . _onClearAction ( ) ;
609615
610616 // De-select dropdown item
611617 if ( this . opened ) {
@@ -641,15 +647,13 @@ export const ComboBoxMixin = (subclass) =>
641647 }
642648
643649 /** @private */
644- _onClick ( e ) {
645- const path = e . composedPath ( ) ;
646-
647- if ( this . _isClearButton ( e ) ) {
648- this . _handleClearButtonClick ( e ) ;
649- } else if ( path . indexOf ( this . _toggleElement ) > - 1 ) {
650- this . _onToggleButtonClick ( e ) ;
650+ _onClick ( event ) {
651+ if ( this . _isClearButton ( event ) ) {
652+ this . _onClearButtonClick ( event ) ;
653+ } else if ( event . composedPath ( ) . includes ( this . _toggleElement ) ) {
654+ this . _onToggleButtonClick ( event ) ;
651655 } else {
652- this . _onHostClick ( e ) ;
656+ this . _onHostClick ( event ) ;
653657 }
654658 }
655659
@@ -827,7 +831,7 @@ export const ComboBoxMixin = (subclass) =>
827831 } else if ( this . clearButtonVisible && ! this . opened && ! ! this . value ) {
828832 e . stopPropagation ( ) ;
829833 // The clear button is visible and the overlay is closed, so clear the value.
830- this . _clear ( ) ;
834+ this . _onClearAction ( ) ;
831835 }
832836 } else if ( this . opened ) {
833837 // Auto-open is enabled
@@ -845,7 +849,7 @@ export const ComboBoxMixin = (subclass) =>
845849 } else if ( this . clearButtonVisible && ! ! this . value ) {
846850 e . stopPropagation ( ) ;
847851 // The clear button is visible and the overlay is closed, so clear the value.
848- this . _clear ( ) ;
852+ this . _onClearAction ( ) ;
849853 }
850854 }
851855
@@ -867,7 +871,7 @@ export const ComboBoxMixin = (subclass) =>
867871 * Clears the current value.
868872 * @protected
869873 */
870- _clear ( ) {
874+ _onClearAction ( ) {
871875 this . selectedItem = null ;
872876
873877 if ( this . allowCustomValue ) {
@@ -1270,12 +1274,6 @@ export const ComboBoxMixin = (subclass) =>
12701274 }
12711275 }
12721276
1273- /** @private */
1274- __onClearButtonMouseDown ( event ) {
1275- event . preventDefault ( ) ; // Prevent native focusout event
1276- this . inputElement . focus ( ) ;
1277- }
1278-
12791277 /** @private */
12801278 _onFocusout ( event ) {
12811279 // VoiceOver on iOS fires `focusout` event when moving focus to the item in the dropdown.
@@ -1308,7 +1306,7 @@ export const ComboBoxMixin = (subclass) =>
13081306 }
13091307
13101308 event . preventDefault ( ) ;
1311- this . _clear ( ) ;
1309+ this . _onClearAction ( ) ;
13121310 }
13131311
13141312 /**
0 commit comments