Skip to content

Commit 0f79bd1

Browse files
authored
Mitigate a typing delay regression in Safari browsers (#2195)
See https://youtrack.jetbrains.com/issue/CMP-8373 for the details Describe proposed changes and the issue being fixed Fixes https://youtrack.jetbrains.com/issue/CMP-8373 ## Testing This should be tested by QA ## Release Notes ### Fixes - Web - Mitigate a typing delay regression in Safari browsers
1 parent bd61d07 commit 0f79bd1

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

compose/ui/ui/src/webCommonW3C/kotlin/androidx/compose/ui/platform/BackingDomInput.kt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,12 @@ internal class BackingDomInput(
8080
}
8181

8282
fun updateHtmlInputBox(left: Float, top: Float, width: Float, height: Float) {
83-
setBackingInputBox(left, top, width, height)
83+
// we coerce the width to at least 1px, to mitigate the typing lags in mobile Safari:
84+
// https://youtrack.jetbrains.com/issue/CMP-8373/Web-Mobile.-TextField.-Typing-input-delay
85+
// Apparently when the width is 0px and the selection index is large enough (big text length),
86+
// the lags become more noticeable.
87+
// I assume it has something to do with text layout. Read more in the comments of the linked issue.
88+
setBackingInputBox(left, top, width.coerceAtLeast(1f), height)
8489
}
8590

8691
fun updateState(textFieldValue: TextFieldValue) {

0 commit comments

Comments
 (0)