@@ -767,11 +767,6 @@ class Input extends UI5Element {
767
767
}
768
768
769
769
_onkeyup ( event ) {
770
- // The native Delete event does not update the value property "on time". So, the (native) change event is always fired with the old value
771
- if ( isDelete ( event ) ) {
772
- this . value = event . target . value ;
773
- }
774
-
775
770
this . _keyDown = false ;
776
771
this . _backspaceKeyDown = false ;
777
772
}
@@ -913,7 +908,10 @@ class Input extends UI5Element {
913
908
const focusedOutToSuggestions = this . Suggestions && event . relatedTarget && event . relatedTarget . shadowRoot && event . relatedTarget . shadowRoot . contains ( this . Suggestions . responsivePopover ) ;
914
909
const focusedOutToValueStateMessage = event . relatedTarget && event . relatedTarget . shadowRoot && event . relatedTarget . shadowRoot . querySelector ( ".ui5-valuestatemessage-root" ) ;
915
910
916
- this . _preventNextChange = this . effectiveShowClearIcon && this . shadowRoot . contains ( event . relatedTarget ) ;
911
+ if ( this . showClearIcon && ! this . effectiveShowClearIcon ) {
912
+ this . _clearIconClicked = false ;
913
+ this . _handleChange ( ) ;
914
+ }
917
915
918
916
// if focusout is triggered by pressing on suggestion item or value state message popover, skip invalidation, because re-rendering
919
917
// will happen before "itemPress" event, which will make item "active" state not visualized
@@ -957,35 +955,30 @@ class Input extends UI5Element {
957
955
}
958
956
}
959
957
960
- _handleNativeInputChange ( ) {
961
- // The native change sometimes fires too early and getting input's value in the listener would return
962
- // the previous value instead of the most recent one. This would make things consistent.
963
- clearTimeout ( this . _nativeChangeDebounce ) ;
964
- this . _nativeChangeDebounce = setTimeout ( ( ) => this . _handleChange ( ) , 100 ) ;
965
- }
966
-
967
958
_handleChange ( ) {
968
- if ( this . _preventNextChange ) {
969
- this . _preventNextChange = false ;
959
+ if ( this . _clearIconClicked ) {
960
+ this . _clearIconClicked = false ;
970
961
return ;
971
962
}
972
963
973
- if ( this . _changeFiredValue !== this . value ) {
974
- this . _changeFiredValue = this . value ;
964
+ if ( this . _changeFiredValue !== this . getInputDOMRefSync ( ) . value ) {
965
+ this . _changeFiredValue = this . getInputDOMRefSync ( ) . value ;
975
966
this . fireEvent ( this . EVENT_CHANGE ) ;
976
967
}
977
968
}
978
969
979
970
_clear ( ) {
980
971
this . value = "" ;
981
972
this . fireEvent ( this . EVENT_INPUT ) ;
982
- this . _handleChange ( ) ;
983
-
984
973
if ( ! this . _isPhone ) {
985
974
this . focus ( ) ;
986
975
}
987
976
}
988
977
978
+ _iconMouseDown ( ) {
979
+ this . _clearIconClicked = true ;
980
+ }
981
+
989
982
_scroll ( event ) {
990
983
const detail = event . detail ;
991
984
this . fireEvent ( "suggestion-scroll" , {
@@ -1187,14 +1180,15 @@ class Input extends UI5Element {
1187
1180
1188
1181
const itemText = item . text || item . textContent ; // keep textContent for compatibility
1189
1182
const fireInput = keyboardUsed
1190
- ? this . valueBeforeItemSelection !== itemText : this . value !== itemText ;
1183
+ ? this . valueBeforeItemSelection !== itemText : this . valueBeforeAutoComplete !== itemText ;
1191
1184
1192
1185
this . hasSuggestionItemSelected = true ;
1193
1186
1194
1187
if ( fireInput ) {
1195
1188
this . value = itemText ;
1196
1189
this . valueBeforeItemSelection = itemText ;
1197
1190
this . lastConfirmedValue = itemText ;
1191
+ this . getInputDOMRefSync ( ) . value = itemText ;
1198
1192
this . fireEvent ( this . EVENT_INPUT ) ;
1199
1193
this . _handleChange ( ) ;
1200
1194
}
0 commit comments