File tree 1 file changed +12
-1
lines changed
1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ import UI5Element from "@ui5/webcomponents-base/dist/UI5Element.js";
2
2
import litRender from "@ui5/webcomponents-base/dist/renderer/LitRenderer.js" ;
3
3
import ResizeHandler from "@ui5/webcomponents-base/dist/delegate/ResizeHandler.js" ;
4
4
import RenderScheduler from "@ui5/webcomponents-base/dist/RenderScheduler.js" ;
5
- import { isIE , isPhone } from "@ui5/webcomponents-base/dist/Device.js" ;
5
+ import { isIE , isPhone , isSafari } from "@ui5/webcomponents-base/dist/Device.js" ;
6
6
import ValueState from "@ui5/webcomponents-base/dist/types/ValueState.js" ;
7
7
import { getFeature } from "@ui5/webcomponents-base/dist/FeaturesRegistry.js" ;
8
8
import {
@@ -843,9 +843,20 @@ class Input extends UI5Element {
843
843
const isSubmit = action === this . ACTION_ENTER ;
844
844
const isUserInput = action === this . ACTION_USER_INPUT ;
845
845
846
+ const input = await this . getInputDOMRef ( ) ;
847
+ const cursorPosition = input . selectionStart ;
848
+
846
849
this . value = inputValue ;
847
850
this . highlightValue = inputValue ;
848
851
852
+ if ( isSafari ( ) ) {
853
+ // When setting the value by hand, Safari moves the cursor when typing in the middle of the text (See #1761)
854
+ setTimeout ( ( ) => {
855
+ input . selectionStart = cursorPosition ;
856
+ input . selectionEnd = cursorPosition ;
857
+ } , 0 ) ;
858
+ }
859
+
849
860
if ( isUserInput ) { // input
850
861
this . fireEvent ( this . EVENT_INPUT ) ;
851
862
// Angular two way data binding
You can’t perform that action at this time.
0 commit comments