@@ -961,19 +961,17 @@ class EditingState {
961961 /// See also:
962962 ///
963963 /// * [applyTextToDomElement] , which is used for non-focused elements.
964- void applyToDomElement (DomHTMLElement ? domElement, {bool isComposing = false }) {
964+ void applyToDomElement (DomHTMLElement ? domElement, {bool updateSelection = true }) {
965965 if (domInstanceOfString (domElement, 'HTMLInputElement' )) {
966966 final DomHTMLInputElement element = domElement! as DomHTMLInputElement ;
967967 element.value = text;
968- if (! isComposing) {
969- // If the user is composing, we should not update the selection range.
968+ if (updateSelection) {
970969 element.setSelectionRange (minOffset, maxOffset);
971970 }
972971 } else if (domInstanceOfString (domElement, 'HTMLTextAreaElement' )) {
973972 final DomHTMLTextAreaElement element = domElement! as DomHTMLTextAreaElement ;
974973 element.value = text;
975- if (! isComposing) {
976- // If the user is composing, we should not update the selection range.
974+ if (updateSelection) {
977975 element.setSelectionRange (minOffset, maxOffset);
978976 }
979977 } else {
@@ -1152,7 +1150,7 @@ class GloballyPositionedTextEditingStrategy extends DefaultTextEditingStrategy {
11521150 // Set the last editing state if it exists, this is critical for a
11531151 // users ongoing work to continue uninterrupted when there is an update to
11541152 // the transform.
1155- lastEditingState? .applyToDomElement (domElement, isComposing : isComposing);
1153+ lastEditingState? .applyToDomElement (domElement, updateSelection : ! isComposing);
11561154 // On Chrome, when a form is focused, it opens an autofill menu
11571155 // immediately.
11581156 // Flutter framework sends `setEditableSizeAndTransform` for informing
@@ -1203,7 +1201,7 @@ class SafariDesktopTextEditingStrategy extends DefaultTextEditingStrategy {
12031201 // the transform.
12041202 // If domElement is not focused cursor location will not be correct.
12051203 moveFocusToActiveDomElement ();
1206- lastEditingState? .applyToDomElement (activeDomElement, isComposing : isComposing);
1204+ lastEditingState? .applyToDomElement (activeDomElement, updateSelection : ! isComposing);
12071205 }
12081206 }
12091207
@@ -1451,7 +1449,7 @@ abstract class DefaultTextEditingStrategy
14511449 if (! isEnabled || ! editingState! .isValid) {
14521450 return ;
14531451 }
1454- lastEditingState! .applyToDomElement (domElement, isComposing : isComposing);
1452+ lastEditingState! .applyToDomElement (domElement, updateSelection : ! isComposing);
14551453 }
14561454
14571455 void placeElement () {
@@ -1900,7 +1898,7 @@ class FirefoxTextEditingStrategy extends GloballyPositionedTextEditingStrategy {
19001898 // Set the last editing state if it exists, this is critical for a
19011899 // users ongoing work to continue uninterrupted when there is an update to
19021900 // the transform.
1903- lastEditingState? .applyToDomElement (activeDomElement, isComposing : isComposing);
1901+ lastEditingState? .applyToDomElement (activeDomElement, updateSelection : ! isComposing);
19041902 }
19051903}
19061904
0 commit comments