Skip to content

Commit 6c2cee7

Browse files
authored
Fix virtual keyboard behaviour on mobile browsers in iOS (#2035)
Fixes https://youtrack.jetbrains.com/issue/CMP-8013 ## Testing Manual and `./gradlew testWeb` ## Release Notes N/A
1 parent 8cb89f5 commit 6c2cee7

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

Diff for: compose/ui/ui/src/webCommonW3C/kotlin/androidx/compose/ui/platform/BackingDomInput.kt

+7-1
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,14 @@ internal class BackingDomInput(
5454
}
5555

5656
fun focus() {
57+
// we focus twice to be sure that ios and non-ios browser both manage to focus
58+
// see https://youtrack.jetbrains.com/issue/CMP-8013
59+
// and https://youtrack.jetbrains.com/issue/CMP-7836/
60+
backingElement.focus()
5761
window.requestAnimationFrame {
58-
backingElement.focus()
62+
if (document.activeElement != backingElement) {
63+
backingElement.focus()
64+
}
5965
}
6066
}
6167

0 commit comments

Comments
 (0)