@@ -606,6 +606,7 @@ class Input extends UI5Element implements SuggestionComponent, IFormInputElement
606
606
} )
607
607
valueStateMessage ! : Array < HTMLElement > ;
608
608
609
+ _isComposing : boolean ;
609
610
hasSuggestionItemSelected : boolean ;
610
611
valueBeforeItemSelection : string ;
611
612
valueBeforeSelectionStart : string ;
@@ -702,17 +703,38 @@ class Input extends UI5Element implements SuggestionComponent, IFormInputElement
702
703
this . _keepInnerValue = false ;
703
704
this . _focusedAfterClear = false ;
704
705
this . _valueStateLinks = [ ] ;
706
+
707
+ // Used to track if the user is composing text.
708
+ this . _isComposing = false ;
705
709
}
706
710
707
711
onEnterDOM ( ) {
708
712
ResizeHandler . register ( this , this . _handleResizeBound ) ;
709
713
registerUI5Element ( this , this . _updateAssociatedLabelsTexts . bind ( this ) ) ;
714
+ const input = this . getInputDOMRefSync ( ) ;
715
+ if ( input ) {
716
+ input . addEventListener ( "compositionstart" , this . _onCompositionStart . bind ( this ) ) ;
717
+ input . addEventListener ( "compositionend" , this . _onCompositionEnd . bind ( this ) ) ;
718
+ }
710
719
}
711
720
712
721
onExitDOM ( ) {
713
722
ResizeHandler . deregister ( this , this . _handleResizeBound ) ;
714
723
deregisterUI5Element ( this ) ;
715
724
this . _removeLinksEventListeners ( ) ;
725
+ const input = this . getInputDOMRefSync ( ) ;
726
+ if ( input ) {
727
+ input . removeEventListener ( "compositionstart" , this . _onCompositionStart . bind ( this ) ) ;
728
+ input . removeEventListener ( "compositionend" , this . _onCompositionEnd . bind ( this ) ) ;
729
+ }
730
+ }
731
+
732
+ _onCompositionStart ( ) {
733
+ this . _isComposing = true ;
734
+ }
735
+
736
+ _onCompositionEnd ( ) {
737
+ this . _isComposing = false ;
716
738
}
717
739
718
740
_highlightSuggestionItem ( item : SuggestionItem ) {
@@ -773,7 +795,7 @@ class Input extends UI5Element implements SuggestionComponent, IFormInputElement
773
795
774
796
// Typehead causes issues on Android devices, so we disable it for now
775
797
// If there is already a selection the autocomplete has already been performed
776
- if ( this . _shouldAutocomplete && ! isAndroid ( ) && ! autoCompletedChars && ! this . _isKeyNavigation ) {
798
+ if ( this . _shouldAutocomplete && ! isAndroid ( ) && ! autoCompletedChars && ! this . _isKeyNavigation && ! this . _isComposing ) {
777
799
const item = this . _getFirstMatchingItem ( value ) ;
778
800
if ( item ) {
779
801
this . _handleTypeAhead ( item ) ;
0 commit comments