Status Update
Comments
no...@google.com <no...@google.com>
se...@google.com <se...@google.com> #2
Over to Ralston to take a look. I imagine with the new relocation logic it should be fixed?
se...@google.com <se...@google.com> #3
What is happening here is that the TextField does not know that it is in a scrollable container, and since the keyboard is going to hide the currently focused text, the text field calls View.requestRectangleOnScreen which causes the entire app to pan up, and that clips the top bar.
The Relocation APIs are experimental right now. It is not used in TextField as we are past the alpha stage and can only use stable APIs in TextField. So this bug can only be fixed post 1.0
ta...@gmail.com <ta...@gmail.com> #4
This should be fixed by
I verified that this sample code now works when soft input mode is AdjustResize.
kl...@google.com <kl...@google.com> #5
I wonder if this is related to the issue described in
to...@steadfastinnovation.com <to...@steadfastinnovation.com> #6
This still seems to be an issue on 1.2.0-beta03
A workaround that seems to be working for us is to have a delay before requesting focus.
LaunchedEffect(focusRequester) {
delay(100)
focusRequester.requestFocus()
}
kl...@google.com <kl...@google.com> #7
Confirmed that the text field is actually getting focus from the effect, so this is definitely an IME issue and not a focus one.
ha...@faire.com <ha...@faire.com> #8
Is there a workaround for this? The issue happens for components that are a part of androidx.compose.ui.window.Popup as well.
I get the following error when a BasicTextField component within a Popup requests focus:
Ignoring showSoftInput() as view=androidx.compose.ui.platform.AndroidComposeView{50b009a VFED..... .F....ID 0,0-1079,2218} is not served.
And the keyboard doesn't show.
When I try to force the keyboard to show using
val imm: InputMethodManager =
LocalContext.current.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
imm.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0)
I see that the keyboard renders behind the Popup component (In my case the contents of the Popup take up a good portion of the screen).
Is there no way to control the Z axis of the contents of my Popup to show behind the system keyboard?
Or is it just not recommended to have a text input field inside a Popup at all?
kl...@google.com <kl...@google.com>
ap...@google.com <ap...@google.com> #9
Branch: androidx-main
commit 16ad8c080ac1284a39ca331e4a6169646b82e62a
Author: Zach Klippenstein <klippenstein@google.com>
Date: Mon Nov 07 16:20:09 2022
Adopt more compat tricks to show/hide IME in Compose APIs.
showSoftInput does not show input reliably when focus is requested.
This CL updates the compose.InputMethodManager implementation
to
- When calling the IMM directly to invoke show/hide commands
(API < 30), follow the best practice of posting those calls to
the main thread instead of running them immediately.
- use WindowInsetsControllerCompat for API ≥ 30
Test: Manual on Emulator 28 & 31, both with dialog and without.
Test: New tests in TextFieldFocusTest
Bug:
Bug:
Change-Id: I0143842913f91d55a4741f16173995a0177dcd64
M compose/foundation/foundation/build.gradle
M compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/ComposeInputField.kt
A compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/FocusTextFieldImmediatelyDemo.kt
M compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/TextDemos.kt
A compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/TextFieldsInDialogDemo.kt
M compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/CoreTextFieldKeyboardScrollableInteractionTest.kt
M compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/DefaultKeyboardActionsTest.kt
M compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/KeyboardActionsTest.kt
M compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/KeyboardHelper.kt
M compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/textfield/TextFieldFocusTest.kt
M compose/ui/ui/build.gradle
M compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/input/TextInputServiceAndroidOnStateUpdateTest.kt
M compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/text/input/InputMethodManager.kt
M compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/text/input/RecordingInputConnection.android.kt
M compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/text/input/TextInputServiceAndroid.android.kt
M compose/ui/ui/src/test/kotlin/androidx/compose/ui/input/RecordingInputConnectionUpdateTextFieldValueTest.kt
M compose/ui/ui/src/test/kotlin/androidx/compose/ui/text/input/TextInputServiceAndroidCommandDebouncingTest.kt
ma...@marcardar.com <ma...@marcardar.com> #10
Also experiencing the same issue (1.4.0-alpha04) as #8 regarding soft keyboard showing behind dialog and so keys cannot be pressed. Any workaround?
EDIT: note, I'm using com.google.android.material.dialog.MaterialAlertDialogBuilder
and setting the content view with a ComposeView
tr...@gmail.com <tr...@gmail.com> #11
Also still experiencing this. On compose 1.3.1. Dumb workaround is to use a delay(100).
ga...@gmail.com <ga...@gmail.com> #12
co...@gmail.com <co...@gmail.com> #13
edit:
delay workaround does not solve it for me
fa...@gmail.com <fa...@gmail.com> #14
ma...@gmail.com <ma...@gmail.com> #15
A more robust workaround that worked for me was waiting for window focus.
val windowInfo = LocalWindowInfo.current
LaunchedEffect(windowInfo) {
snapshotFlow { windowInfo.isWindowFocused }.collect { isWindowFocused ->
if (isWindowFocused) {
focusRequester.requestFocus()
}
}
}
pe...@gmail.com <pe...@gmail.com> #16
pe...@gmail.com <pe...@gmail.com> #17
pe...@gmail.com <pe...@gmail.com> #18
rh...@gmail.com <rh...@gmail.com> #19
Any update on this? Experiencing this in M3 and Compose 1.6.
Causes our UI tests to fail about 20% of the time since our UI tests are written with the keyboard open and thus when it's not causes scrolling and assertion issues.
z....@ocado.com <z....@ocado.com> #21
Can you link to the commit where this was fixed? I'm interested in the implementation that fixes this. Also, is the fix available in 1.7.0-beta02 release?
Description
Jetpack Compose release version: 1.0.1 Android Studio Build:Artic Fox Kotlin version: 1.5.21
I'm trying to bring the soft keyboard up when automatically when a Dialog composable is shown that contains a TextField, however it doesn't work. This same exact code sample works if the TextField is not in a Dialog