Status Update
Comments
an...@google.com <an...@google.com>
wa...@gmail.com <wa...@gmail.com> #2
Which API level are you seeing the issue here with?
wa...@gmail.com <wa...@gmail.com> #3
My hunch is that this is related to DialogFragment
or ComponentDialog
adds a new Window
that the contained ComposeView
is not aware of.
gr...@gmail.com <gr...@gmail.com> #4
I've only tested this on API level 33 and 26 so far, and out of these two I'm seeing this only on 33
wa...@gmail.com <wa...@gmail.com> #5
wa...@gmail.com <wa...@gmail.com> #6
Experiencing the same issue. Slowly migrating the project to compose and i still need the some compose views to be inside a DialogFragment.
b9...@gmail.com <b9...@gmail.com> #7
Faced the same and like #3 mentioned, compose switched to use a DialogWindowProvider
to figure out its window.
To workaround it in the meantime I copied ComposeView and made it report my dialog window. Not easy, but you cant get past creating a subclass.
internal abstract class ComposeBottomSheetFragment : BottomSheetDialogFragment() { // Can be simple DialogFragment
@Composable protected abstract fun Content()
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
return ComposeDialogView(requireContext()).also {
it.consumeWindowInsets = false
it.layoutParams = LayoutParams(MATCH_PARENT, WRAP_CONTENT)
it.setContent {
OurTheme { Content() }
}
}
}
// Copy of ComposeView that is able to supply the dialog window to compose.
// I used inner class but you can also pass a lambda to the view and lazily request the window
inner class ComposeDialogView(context: Context) : AbstractComposeView(context, null, 0), DialogWindowProvider {
// The important bit
override val window get() = requireDialog().window!!
private val content = mutableStateOf<(@Composable () -> Unit)?>(null)
override var shouldCreateCompositionOnAttachedToWindow: Boolean = false
private set
@Composable
override fun Content() {
content.value?.invoke()
}
override fun getAccessibilityClassName(): CharSequence = ComposeView::class.java.name
/**
* Set the Jetpack Compose UI content for this view.
* Initial composition will occur when the view becomes attached to a window or when
* [createComposition] is called, whichever comes first.
*/
fun setContent(content: @Composable () -> Unit) {
shouldCreateCompositionOnAttachedToWindow = true
this.content.value = content
if (isAttachedToWindow) createComposition()
}
}
private var ComposeDialogView.consumeWindowInsets: Boolean
get() = getTag(androidx.compose.ui.R.id.consume_window_insets_tag) as? Boolean ?: true
set(value) {
setTag(androidx.compose.ui.R.id.consume_window_insets_tag, value)
}
}
wa...@gmail.com <wa...@gmail.com> #8
That workaround should work, due to this line:
Only seeing this issue on API 30 and above also makes sense, due to the underlying mechanics.
ez...@gmail.com <ez...@gmail.com> #9
I tested with the stable 1.4.0 version, having the same problem.
os...@gmail.com <os...@gmail.com> #11
override val window by lazy {
requireDialog().window!!
}
wa...@gmail.com <wa...@gmail.com> #12
It looks like in my case that it tries to fetch the window to close the soft keyboard after the dialog window has disappeared
java.lang.NullPointerException
at com.xyz.compose.ComposeDialogFragment$windowProvider$2$1.getWindow(ComposeFragment.kt:101)
at com.xyz.compose.ComposeDialogFragment$ComposeDialogView.getWindow(Unknown Source:2)
at androidx.compose.ui.text.input.ImmHelper30.findWindow(InputMethodManager.kt:159)
at androidx.compose.ui.text.input.ImmHelper30.getInsetsControllerCompat(InputMethodManager.kt:133)
at androidx.compose.ui.text.input.ImmHelper30.hideSoftInput(InputMethodManager.kt:152)
at androidx.compose.ui.text.input.InputMethodManagerImpl.hideSoftInput(InputMethodManager.kt:83)
at androidx.compose.ui.text.input.TextInputServiceAndroid.setKeyboardVisibleImmediately(TextInputServiceAndroid.android.kt:397)
at androidx.compose.ui.text.input.TextInputServiceAndroid.processInputCommands(TextInputServiceAndroid.android.kt:302)
at androidx.compose.ui.text.input.TextInputServiceAndroid.sendInputCommand$lambda$1(TextInputServiceAndroid.android.kt:209)
at androidx.compose.ui.text.input.TextInputServiceAndroid.$r8$lambda$tFIm8sXGny3G873nGUe23EJe7OY(Unknown Source:0)
at androidx.compose.ui.text.input.TextInputServiceAndroid$$ExternalSyntheticLambda0.run(Unknown Source:2)
at androidx.compose.ui.text.input.TextInputServiceAndroid_androidKt.asExecutor$lambda$1$lambda$0(TextInputServiceAndroid.android.kt:504)
at androidx.compose.ui.text.input.TextInputServiceAndroid_androidKt.$r8$lambda$RYljF3nl5HRu6JKEM8xFRHwbGFg(Unknown Source:0)
at androidx.compose.ui.text.input.TextInputServiceAndroid_androidKt$$ExternalSyntheticLambda0.doFrame(Unknown Source:2)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1229)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1239)
at android.view.Choreographer.doCallbacks(Choreographer.java:899)
at android.view.Choreographer.doFrame(Choreographer.java:827)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1214)
at android.os.Handler.handleCallback(Handler.java:942)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.app.ActivityThread.main(ActivityThread.java:7872)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
gr...@gmail.com <gr...@gmail.com> #13
Any progress on this issue? Seems like it breaks a lot of things, I can't migrate to 1.4
wa...@gmail.com <wa...@gmail.com> #14
Branch: androidx-main
commit 1763fd0e7b7e11e0ac928762c2c6d16f0c049762
Author: Zach Klippenstein <klippenstein@google.com>
Date: Thu Apr 13 14:34:16 2023
Fix keyboard not showing when text field is in non-Compose dialog.
Fixes:
Test: TextFieldFocusCustomDialogTest
Relnote: "Fixed regression where keyboard wasn't showing for text fields
inside dialogs not created by the `Dialog` composable."
Change-Id: I825512cde7e41dadfc8b7491bd24190d21b14729
M compose/foundation/foundation/build.gradle
M compose/foundation/foundation/src/androidAndroidTest/AndroidManifest.xml
A compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/textfield/TextFieldFocusCustomDialogTest.kt
M compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/text/input/InputMethodManager.kt
gr...@gmail.com <gr...@gmail.com> #15
There is any plan about which version is the bug fix planned to be released in?
wa...@gmail.com <wa...@gmail.com> #17
Thanks for the explanation, so the BOM versions will also be updated within a month (like 2023.04.xx)? If so, that will be great!
po...@gmail.com <po...@gmail.com> #18
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.compose.foundation:foundation:1.4.2
androidx.compose.ui:ui:1.4.2
oo...@gmail.com <oo...@gmail.com> #19
Branch: androidx-main
commit 7545cec3617ab5d1ea83d66822bc094e7f03c562
Author: José Figueroa Santos <serniebanders@google.com>
Date: Wed Apr 19 16:04:18 2023
[Material3][gradle] Update compose dependencies to 1.4.2
Upgrade needed to intake the following bug fix:
Bug: 268380384
Bug: 272483584
RelNote: ModalBottomSheet now can display IME keyboard
Test: Manual
Change-Id: Idc5082008acb547cac2100a69cab4be7db85f50f
M compose/material3/material3/build.gradle
M compose/material3/material3/samples/src/main/java/androidx/compose/material3/samples/BottomSheetSamples.kt
ch...@gmail.com <ch...@gmail.com> #20
I am using compose and my dependencies are as follows:
def composeBom = platform('androidx.compose:compose-bom:2023.01.00')
implementation composeBom
androidTestImplementation composeBom
// Material Design 3
implementation "androidx.compose.material3:material3:$compose_material3_version"
implementation "androidx.compose.material3:material3-window-size-class:$compose_material3_version"
implementation 'androidx.compose.ui:ui:1.5.0-alpha03'.
Once I hide the modal bottom sheet, only then does the keyboard shows up. Strange
ma...@gmail.com <ma...@gmail.com> #21
si...@google.com <si...@google.com> #22
ch...@gmail.com <ch...@gmail.com> #23
aa...@icloud.com <aa...@icloud.com> #24
ma...@voltasit.com <ma...@voltasit.com> #26
Such a serious bug and nobody pays normal attention to it.
there is a hack described in this post
for now I use this approach, but I really hope that someone from Google will eventually fix this frustrating bug.
lu...@gmail.com <lu...@gmail.com> #27
Hi,
keyboard was shown properly in compose 1.4.3 but in 1.5.0-alpha03 it stopped working again.
In 1.4.3 and 1.5.0-alpha03 now i have following issue which causing app crash.
1 @main: CRASH DETECTED on thread Thread[main,5,main]
E java.lang.IllegalStateException: LayoutCoordinate operations are only valid when isAttached is true
E at androidx.compose.ui.node.NodeCoordinator.localToRoot-MK-Hz9U(NodeCoordinator.kt:850)
E at androidx.compose.foundation.text.TextFieldDelegate$Companion.notifyFocusedRect$foundation_release(TextFieldDelegate.kt:173)
E at androidx.compose.foundation.text.CoreTextFieldKt.notifyFocusedRect(CoreTextField.kt:1111)
E at androidx.compose.foundation.text.CoreTextFieldKt.notifyTextInputServiceOnFocusChange(CoreTextField.kt:962)
E at androidx.compose.foundation.text.CoreTextFieldKt.access$notifyTextInputServiceOnFocusChange(CoreTextField.kt:1)
E at androidx.compose.foundation.text.CoreTextFieldKt$CoreTextField$focusModifier$1.invoke(CoreTextField.kt:293)
E at androidx.compose.foundation.text.CoreTextFieldKt$CoreTextField$focusModifier$1.invoke(CoreTextField.kt:282)
E at androidx.compose.ui.focus.FocusChangedModifierNode.onFocusEvent(FocusChangedModifier.kt:59)
E at androidx.compose.ui.focus.FocusEventModifierNodeKt.refreshFocusEventNodes(FocusEventModifierNode.kt:68)
E at androidx.compose.ui.focus.FocusTransactionsKt.requestFocusForChild(FocusTransactions.kt:208)
E at androidx.compose.ui.focus.FocusTransactionsKt.performRequestFocus(FocusTransactions.kt:69)
E at androidx.compose.ui.focus.FocusTransactionsKt.requestFocus(FocusTransactions.kt:44)
E at androidx.compose.ui.focus.FocusRequester.focus$ui_release(FocusRequester.kt:72)
E at androidx.compose.ui.focus.FocusRequester.requestFocus(FocusRequester.kt:63)
E at androidx.compose.foundation.text.CoreTextFieldKt.tapToFocus(CoreTextField.kt:939)
E at androidx.compose.foundation.text.CoreTextFieldKt.access$tapToFocus(CoreTextField.kt:1)
E at androidx.compose.foundation.text.CoreTextFieldKt$CoreTextField$pointerModifier$1.invoke-k-4lQ0M(CoreTextField.kt:342)
E at androidx.compose.foundation.text.CoreTextFieldKt$CoreTextField$pointerModifier$1.invoke(CoreTextField.kt:341)
E at androidx.compose.foundation.text.TextFieldPressGestureFilterKt$tapPressTextFieldModifier$1$2$2.invoke-k-4lQ0M(TextFieldPressGestureFilter.kt:81)
E at androidx.compose.foundation.text.TextFieldPressGestureFilterKt$tapPressTextFieldModifier$1$2$2.invoke(TextFieldPressGestureFilter.kt:54)
E at androidx.compose.foundation.gestures.TapGestureDetectorKt$detectTapAndPress$2$1.invokeSuspend(TapGestureDetector.kt:255)
E at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
E at kotlinx.coroutines.DispatchedTaskKt.resume(DispatchedTask.kt:178)
E at kotlinx.coroutines.DispatchedTaskKt.dispatch(DispatchedTask.kt:166)
E at kotlinx.coroutines.CancellableContinuationImpl.dispatchResume(CancellableContinuationImpl.kt:397)
E at kotlinx.coroutines.CancellableContinuationImpl.resumeImpl(CancellableContinuationImpl.kt:431)
E at kotlinx.coroutines.CancellableContinuationImpl.resumeImpl$default(CancellableContinuationImpl.kt:420)
E at kotlinx.coroutines.CancellableContinuationImpl.resumeWith(CancellableContinuationImpl.kt:328)
E at androidx.compose.ui.input.pointer.SuspendingPointerInputModifierNodeImpl$PointerEventHandlerCoroutine.offerPointerEvent(SuspendingPointerInputFilter.kt:672)
E at androidx.compose.ui.input.pointer.SuspendingPointerInputModifierNodeImpl.dispatchPointerEvent(SuspendingPointerInputFilter.kt:548)
E at androidx.compose.ui.input.pointer.SuspendingPointerInputModifierNodeImpl.onPointerEvent-H0pRuoY(SuspendingPointerInputFilter.kt:570)
E at androidx.compose.ui.input.pointer.Node.dispatchMainEventPass(HitPathTracker.kt:314)
E at androidx.compose.ui.input.pointer.Node.dispatchMainEventPass(HitPathTracker.kt:301)
E at androidx.compose.ui.input.pointer.Node.dispatchMainEventPass(HitPathTracker.kt:301)
E at androidx.compose.ui.input.pointer.Node.dispatchMainEventPass(HitPathTracker.kt:301)
E at androidx.compose.ui.input.pointer.Node.dispatchMainEventPass(HitPathTracker.kt:301)
E at androidx.compose.ui.input.pointer.Node.dispatchMainEventPass(HitPathTracker.kt:301)
E at androidx.compose.ui.input.pointer.NodeParent.dispatchMainEventPass(HitPathTracker.kt:183)
E at androidx.compose.ui.input.pointer.HitPathTracker.dispatchChanges(HitPathTracker.kt:102)
E at androidx.compose.ui.input.pointer.PointerInputEventProcessor.process-BIzXfog(PointerInputEventProcessor.kt:98)
E at androidx.compose.ui.platform.AndroidComposeView.sendMotionEvent-8iAsVTc(AndroidComposeView.android.kt:1371)
E at androidx.compose.ui.platform.AndroidComposeView.handleMotionEvent-8iAsVTc(AndroidComposeView.android.kt:1323)
E at androidx.compose.ui.platform.AndroidComposeView.dispatchTouchEvent(AndroidComposeView.android.kt:1263)
E at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3121)
E at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2802)
E at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3121)
E at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2802)
E at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3121)
E at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2802)
E at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3121)
E at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2802)
E at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3121)
E at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2802)
E at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3121)
E at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2802)
E at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3121)
E at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2802)
E at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3121)
E at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2802)
E at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3121)
E at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2802)
E at com.android.internal.policy.DecorView.superDispatchTouchEvent(DecorView.java:500)
E at com.android.internal.policy.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1905)
E at android.app.Dialog.dispatchTouchEvent(Dialog.java:911)
E at androidx.appcompat.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:70)
E at com.android.internal.policy.DecorView.dispatchTouchEvent(DecorView.java:458)
E at android.view.View.dispatchPointerEvent(View.java:15262)
E at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:6654)
E at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:6454)
E at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5910)
E at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:5967)
E at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:5933)
E at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:6098)
E at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:5941)
E at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:6155)
E at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5914)
E at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:5967)
E at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:5933)
E at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:5941)
E at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5914)
E at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:8996)
E at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:8947)
E at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:8916)
E at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:9119)
E at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:267)
E at android.os.MessageQueue.nativePollOnce(Native Method)
E at android.os.MessageQueue.next(MessageQueue.java:335)
E at android.os.Looper.loopOnce(Looper.java:161)
E at android.os.Looper.loop(Looper.java:288)
E at android.app.ActivityThread.main(ActivityThread.java:7872)
E at java.lang.reflect.Method.invoke(Native Method)
E at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
E at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
E Suppressed: kotlinx.coroutines.DiagnosticCoroutineContextException: [androidx.compose.ui.platform.MotionDurationScaleImpl@a05fbf2, androidx.compose.runtime.BroadcastFrameClock@67c3243, StandaloneCoroutine{Cancelling}@d0400c0, AndroidUiDispatcher@76f01f9]
Steps to reproduce should be quite simple. Just create some BottomSheetDialogFragment which will have compose view inside and in that compose view you should have some TextInputs. Also im using FocusRequester in that compose screen.
In compose 1.4.3 - keyboard was shown properly when i clicked into text inputs there BUT if i clicked on some input which was partially hidden under keyboard it caused crash (see stacktrace above). In compose 1.5.0-alpha03 - keyboard is not showing when i clicked into some text input - instead it will just do that crash (see stacktrace above).
This issue occur on Samsung S23 and also on emulator.
I think its related to
Please act urgently and increase this ticket priority because its important issue. Thanks
ar...@gmail.com <ar...@gmail.com> #28
ez...@gmail.com <ez...@gmail.com> #29
when using the emulator, keyboard doesn't show up until you start typing using the hardware keyboard
ja...@gmail.com <ja...@gmail.com> #30
P1 since it is reported to be a regression.
ja...@gmail.com <ja...@gmail.com> #31
First, prioritizing this as a regression for 1.5 and adding to burndown list. Lets get this sorted.
Second, the fix in this bug is only included in:
- Patch release: 1.4.3
- Alpha release: 1.5.0-alpha04
It was not included in 1.5.0-alpha03 as it didn't make the release cut.
In compose 1.4.3 - keyboard was shown properly when i clicked into text inputs there BUT if i clicked on some input which was partially hidden under keyboard it caused crash (see stacktrace above).
Thank you!
Can you share a minimal repro against 1.4.3 or 1.5.0-alpha04 with repro steps help expedite the fix.
Thanks!
an...@gmail.com <an...@gmail.com> #32
I tried version 1.5.0-alpha04 - keyboard is shown properly in that dialog but there is still that crash below (but its related to
E at androidx.compose.ui.node.NodeCoordinator.localToRoot-MK-Hz9U(NodeCoordinator.kt:844)
E at androidx.compose.foundation.text.TextFieldDelegate$Companion.notifyFocusedRect$foundation_release(TextFieldDelegate.kt:173)
E at androidx.compose.foundation.text.CoreTextFieldKt.notifyFocusedRect(CoreTextField.kt:1111)
E at androidx.compose.foundation.text.CoreTextFieldKt.notifyTextInputServiceOnFocusChange(CoreTextField.kt:962)
E at androidx.compose.foundation.text.CoreTextFieldKt.access$notifyTextInputServiceOnFocusChange(CoreTextField.kt:1)
E at androidx.compose.foundation.text.CoreTextFieldKt$CoreTextField$focusModifier$1.invoke(CoreTextField.kt:293)
E at androidx.compose.foundation.text.CoreTextFieldKt$CoreTextField$focusModifier$1.invoke(CoreTextField.kt:282)
E at androidx.compose.ui.focus.FocusChangedModifierNode.onFocusEvent(FocusChangedModifier.kt:59)
E at androidx.compose.ui.focus.FocusEventModifierNodeKt.refreshFocusEventNodes(FocusEventModifierNode.kt:68)
E at androidx.compose.ui.focus.FocusTransactionsKt.requestFocusForChild(FocusTransactions.kt:208)
E at androidx.compose.ui.focus.FocusTransactionsKt.performRequestFocus(FocusTransactions.kt:69)
E at androidx.compose.ui.focus.FocusTransactionsKt.requestFocus(FocusTransactions.kt:44)
E at androidx.compose.ui.focus.FocusRequester.focus$ui_release(FocusRequester.kt:72)
E at androidx.compose.ui.focus.FocusRequester.requestFocus(FocusRequester.kt:63)
E at androidx.compose.foundation.text.CoreTextFieldKt.tapToFocus(CoreTextField.kt:939)
E at androidx.compose.foundation.text.CoreTextFieldKt.access$tapToFocus(CoreTextField.kt:1)
E at androidx.compose.foundation.text.CoreTextFieldKt$CoreTextField$pointerModifier$1.invoke-k-4lQ0M(CoreTextField.kt:342)
E at androidx.compose.foundation.text.CoreTextFieldKt$CoreTextField$pointerModifier$1.invoke(CoreTextField.kt:341)
E at androidx.compose.foundation.text.TextFieldPressGestureFilterKt$tapPressTextFieldModifier$1$2$2.invoke-k-4lQ0M(TextFieldPressGestureFilter.kt:81)
E at androidx.compose.foundation.text.TextFieldPressGestureFilterKt$tapPressTextFieldModifier$1$2$2.invoke(TextFieldPressGestureFilter.kt:54)
E at androidx.compose.foundation.gestures.TapGestureDetectorKt$detectTapAndPress$2$1.invokeSuspend(TapGestureDetector.kt:255)
E at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
E at kotlinx.coroutines.DispatchedTaskKt.resume(DispatchedTask.kt:178)
E at kotlinx.coroutines.DispatchedTaskKt.dispatch(DispatchedTask.kt:166)
E at kotlinx.coroutines.CancellableContinuationImpl.dispatchResume(CancellableContinuationImpl.kt:397)
E at kotlinx.coroutines.CancellableContinuationImpl.resumeImpl(CancellableContinuationImpl.kt:431)
E at kotlinx.coroutines.CancellableContinuationImpl.resumeImpl$default(CancellableContinuationImpl.kt:420)
E at kotlinx.coroutines.CancellableContinuationImpl.resumeWith(CancellableContinuationImpl.kt:328)
E at androidx.compose.ui.input.pointer.SuspendingPointerInputModifierNodeImpl$PointerEventHandlerCoroutine.offerPointerEvent(SuspendingPointerInputFilter.kt:670)
E at androidx.compose.ui.input.pointer.SuspendingPointerInputModifierNodeImpl.dispatchPointerEvent(SuspendingPointerInputFilter.kt:546)
E at androidx.compose.ui.input.pointer.SuspendingPointerInputModifierNodeImpl.onPointerEvent-H0pRuoY(SuspendingPointerInputFilter.kt:568)
E at androidx.compose.ui.input.pointer.Node.dispatchMainEventPass(HitPathTracker.kt:317)
E at androidx.compose.ui.input.pointer.Node.dispatchMainEventPass(HitPathTracker.kt:303)
E at androidx.compose.ui.input.pointer.Node.dispatchMainEventPass(HitPathTracker.kt:303)
E at androidx.compose.ui.input.pointer.Node.dispatchMainEventPass(HitPathTracker.kt:303)
E at androidx.compose.ui.input.pointer.Node.dispatchMainEventPass(HitPathTracker.kt:303)
E at androidx.compose.ui.input.pointer.Node.dispatchMainEventPass(HitPathTracker.kt:303)
E at androidx.compose.ui.input.pointer.NodeParent.dispatchMainEventPass(HitPathTracker.kt:183)
E at androidx.compose.ui.input.pointer.HitPathTracker.dispatchChanges(HitPathTracker.kt:102)
E at androidx.compose.ui.input.pointer.PointerInputEventProcessor.process-BIzXfog(PointerInputEventProcessor.kt:96)
E at androidx.compose.ui.platform.AndroidComposeView.sendMotionEvent-8iAsVTc(AndroidComposeView.android.kt:1376)
E at androidx.compose.ui.platform.AndroidComposeView.handleMotionEvent-8iAsVTc(AndroidComposeView.android.kt:1328)
E at androidx.compose.ui.platform.AndroidComposeView.dispatchTouchEvent(AndroidComposeView.android.kt:1268)
E at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3121)
E at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2802)
E at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3121)
E at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2802)
E at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3121)
E at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2802)
E at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3121)
E at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2802)
E at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3121)
E at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2802)
E at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3121)
E at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2802)
E at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3121)
E at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2802)
E at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3121)
E at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2802)
E at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:3121)
E at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2802)
E at com.android.internal.policy.DecorView.superDispatchTouchEvent(DecorView.java:500)
E at com.android.internal.policy.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1905)
E at android.app.Dialog.dispatchTouchEvent(Dialog.java:911)
E at androidx.appcompat.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:70)
E at com.android.internal.policy.DecorView.dispatchTouchEvent(DecorView.java:458)
E at android.view.View.dispatchPointerEvent(View.java:15262)
E at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:6654)
E at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:6454)
E at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5910)
E at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:5967)
E at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:5933)
E at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:6098)
E at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:5941)
E at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:6155)
E at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5914)
E at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:5967)
E at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:5933)
E at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:5941)
E at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5914)
E at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:8996)
E at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:8947)
E at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:8916)
E at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:9119)
E at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:267)
E at android.os.MessageQueue.nativePollOnce(Native Method)
E at android.os.MessageQueue.next(MessageQueue.java:335)
E at android.os.Looper.loopOnce(Looper.java:161)
E at android.os.Looper.loop(Looper.java:288)
E at android.app.ActivityThread.main(ActivityThread.java:7872)
E at java.lang.reflect.Method.invoke(Native Method)
E at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
E at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
E Suppressed: kotlinx.coroutines.DiagnosticCoroutineContextException: [androidx.compose.ui.platform.MotionDurationScaleImpl@dc5dd85, androidx.compose.runtime.BroadcastFrameClock@9c07da, StandaloneCoroutine{Cancelling}@96ff40b, AndroidUiDispatcher@c8872e8]```
he...@gmail.com <he...@gmail.com> #33
Thanks, we've split the TextField bits of
From my testing it looks like the relevant keyboard ime for this ticket is now fixed, and a new bug (
I will close this ticket if the only issue currently is the crash caused by !isAttached
which is now tracked in a new bug.
If anyone has a repro other than the following crash, please comment and will re-open.
Crash below now tracked in b/281984756
1 @main: CRASH DETECTED on thread Thread[main,5,main]
E java.lang.IllegalStateException: LayoutCoordinate operations are only valid when isAttached is true
E at androidx.compose.ui.node.NodeCoordinator.localToRoot-MK-Hz9U(NodeCoordinator.kt:850)
E at androidx.compose.foundation.text.TextFieldDelegate$Companion.notifyFocusedRect$foundation_release(TextFieldDelegate.kt:173)
E at androidx.compose.foundation.text.CoreTextFieldKt.notifyFocusedRect(CoreTextField.kt:1111)
ja...@deepl.com <ja...@deepl.com> #34
ma...@memrise.com <ma...@memrise.com> #35
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.compose.material3:material3-android:1.2.0-alpha02
pr...@gmail.com <pr...@gmail.com> #36
sa...@gmail.com <sa...@gmail.com> #37
I encountered the problem described above on devices with API 28 (emulator and real device). When receiving focus on a TextField(BasicTextField) inside a ModalBottomSheet that is called from a BottomSheetDialogFragment, the keyboard does not appear.
I tried using the hack described above, but it doesn't work.
The latest BOM version is currently 2024.02.00.
sa...@gmail.com <sa...@gmail.com> #38
With Compose BOM Version 2024.02.00, the keyboard is still not showing in a DialogFragment, where ComposeView is used from within onCreateDialog with AlertDialog.Builder.setView as described in
[Deleted User] <[Deleted User]> #39
bug still happen with compose bom version 2024.05.00
、、、
java.lang.NullPointerException: Attempt to invoke virtual method 'android.view.WindowInsetsController com.android.internal.policy.DecorView.getWindowInsetsController()' on a null object reference at com.android.internal.policy.PhoneWindow.getInsetsController(PhoneWindow.java:3930) at androidx.core.view.WindowInsetsControllerCompat$Impl30.<init>(WindowInsetsControllerCompat.java:613) at androidx.core.view.WindowInsetsControllerCompat.<init>(WindowInsetsControllerCompat.java:102) at androidx.compose.ui.text.input.ImmHelper30.getInsetsControllerCompat(InputMethodManager.kt:133) at androidx.compose.ui.text.input.ImmHelper30.hideSoftInput(InputMethodManager.kt:152) at androidx.compose.ui.text.input.InputMethodManagerImpl.hideSoftInput(InputMethodManager.kt:83) at androidx.compose.ui.text.input.TextInputServiceAndroid.setKeyboardVisibleImmediately(TextInputServiceAndroid.android.kt:397) at androidx.compose.ui.text.input.TextInputServiceAndroid.processInputCommands(TextInputServiceAndroid.android.kt:302) at androidx.compose.ui.text.input.TextInputServiceAndroid.sendInputCommand$lambda$1(TextInputServiceAndroid.android.kt:209) at androidx.compose.ui.text.input.TextInputServiceAndroid.$r8$lambda$tFIm8sXGny3G873nGUe23EJe7OY(Unknown Source:0) at androidx.compose.ui.text.input.TextInputServiceAndroid$$ExternalSyntheticLambda0.run(Unknown Source:2) at androidx.compose.ui.text.input.TextInputServiceAndroid_androidKt.asExecutor$lambda$1$lambda$0(TextInputServiceAndroid.android.kt:504) at androidx.compose.ui.text.input.TextInputServiceAndroid_androidKt.$r8$lambda$RYljF3nl5HRu6JKEM8xFRHwbGFg(Unknown Source:0) at androidx.compose.ui.text.input.TextInputServiceAndroid_androidKt$$ExternalSyntheticLambda0.doFrame(Unknown Source:2) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1229) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1239) at android.view.Choreographer.doCallbacks(Choreographer.java:899) at android.view.Choreographer.doFrame(Choreographer.java:827) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1214) at android.os.Handler.handleCallback(Handler.java:942) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loopOnce(Looper.java:201) at android.os.Looper.loop(Looper.java:288) at android.app.ActivityThread.main(ActivityThread.java:7872) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
、、、
si...@gmail.com <si...@gmail.com> #40
This bug is still present in BOM 2024.10.00
co...@protonmail.com <co...@protonmail.com> #41
co...@protonmail.com <co...@protonmail.com> #42
I spoke too soon. It worked in an emulator, but didn't scroll up automatically on my physical pixel 6.
si...@gmail.com <si...@gmail.com> #43
Yeah, when I read your post I thought that there were some fixes in the 1.1.0-RC01, but it doesn't work.
co...@protonmail.com <co...@protonmail.com> #44
For what its worth. I spent the entire day trying out all of the solutions above with no luck.
If anyone can figure out how to put 20 field inputs in a column (either scrollable or LazyColumn) and you can hit the ImeAction.Next button and scroll through all the items... please let me know. =)
si...@gmail.com <si...@gmail.com> #45
You have to do it manually. If you read my solution (comment 40) I calculated the exact amount of scroll needed based on the size of the single item, of the lazycolumn and of the keyboard. You can adapt the code to manually scroll of that amount when you hit the keyboard button
wa...@gmail.com <wa...@gmail.com> #46
Bring Into View Requester takes a rect , I would like to give it offset , let's say there another composable that needs to be always visible above the IME like a footer with buttons like in text editor applications , Now that composable might come above the text field when staying above the IME and the current line user is writing is underneath that footer thingy ! I wish I could provide offsets and move the text field more into y direction than it needs to , as much needed for my footer to always by visible below the text field and above the IME
co...@protonmail.com <co...@protonmail.com> #47
@si...@gmail.com OH! I thought your comment did handle the keyboard button. I guess I will give it another try. Not to give you more work... but if there any chance you could get a working repo of this up on github. Might be slightly easier to follow your code along there. I will try to give your idea a whirl when I get back to my desk.
tr...@gmail.com <tr...@gmail.com> #48
Has anyone tried it out yet? And why hasn't someone from Google reported on this here yet?
br...@gmail.com <br...@gmail.com> #49
RE #48... That looks like a different issue. The issue here is that when the ime slides into view, the textfield is not scrolled up and into view (so that you can see what you are typing)
The issue that is fixed in 1.2 looks to be an issue where the cursor doesn't properly scroll out of view when you scroll. That issue is here:
ed...@gmail.com <ed...@gmail.com> #50
Just came across this issue as well. BringIntoViewRequester()
/ bringIntoView()
still broken for me in 1.2.0-alpha01
Only work with delay and even then only 1 time or after focusing different text fields first.
UGH!
nu...@gmail.com <nu...@gmail.com> #51
Compose is causing so much pain in all UX-things. It is not clear why 1.0.0+ is called "stable", if it is still impossible to сomplete default tasks, which were solved very simply for 10 years.
Obviosly it's a lie that there is less code or that it speeds up development - everything is in so raw state, so with this you can only write "hello world" apps or simple pets.
In production you cannot tell clients "Sorry, its P4 in google list. Wait another year or two :)".
pr...@intercom.io <pr...@intercom.io> #52
Issues like this make people really skeptical of using what you call "stable" and drastically slow down adoption.
kl...@google.com <kl...@google.com>
kl...@google.com <kl...@google.com> #53
The main issue was that notifyFocusedRect
was only asking the view to show the rect, not using Compose's mechanism for this, BringIntoViewRequester
.
There's also an issue specifically with lazy lists, where if the field is too low, when the IME shows it disposes the composition containing the field before it has a chance to be brought into view. Once this bug is fixed, the lazy list issue should be fixed once lazy lists are able to keep focused nodes in the composition even when scrolled out of view (
The fix involves implementing
Note this is similar, but I think different than
WIP CL that will eventually contain the fix:
to...@gmail.com <to...@gmail.com> #54
For the record I do not think it was reported in this thread, but there's also a side case, where the scroll does work, but when the keyboard change it's size there's nothing happening. Like the GBoard, you click on a field it scroll, the keyboard is visible, then a top bar on the keyboard is shown with suggestions and it appears over of the field.
kl...@google.com <kl...@google.com> #55
The investigation last week turned up a number of cases we weren't handling, and some were easier to fix than others. ADJUST_PAN
, but for ADJUST_RESIZE
we need to implement a piece of focus infrastructure that doesn't exist yet (
ap...@google.com <ap...@google.com> #56
Branch: androidx-main
commit 22f05f8acfc4a9dfd93a00c537708f26ae8dbe4e
Author: Zach Klippenstein <klippenstein@google.com>
Date: Tue Feb 01 12:27:01 2022
Set focused child before granting it focus.
Fixes a bug where if an onFocusEvent searched for the active FocusModifier
it would crash because the newly-focused child hadn't been set on the
parent modifier yet.
Also cleaned up some code comments in related files – scout rule!
Bug:
Bug:
Test: ./gradlew :compose:ui:ui:cDAT
Change-Id: I1ba0a3411cb3793099b12913a25a8b0d92f74c40
M compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/focus/FindFocusableChildrenTest.kt
M compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/focus/FocusTestUtils.kt
M compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/focus/FocusTransactions.kt
ap...@google.com <ap...@google.com> #57
Branch: androidx-main
commit 314a8bd718c5c905444bc538c6d04e3a4805d848
Author: Zach Klippenstein <klippenstein@google.com>
Date: Wed Feb 02 09:54:40 2022
Fix a bunch of flaky tests caused by performing focus operations off the UI thread.
Bug:
Bug:
Test: Tests are fixed.
Change-Id: I15ee7001a1128486939c273434ef28a41d84ed79
M compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/focus/TwoDimensionalFocusTraversalThreeItemsTest.kt
M compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/focus/TwoDimensionalFocusTraversalTwoItemsTest.kt
M compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/focus/CustomFocusTraversalTest.kt
ap...@google.com <ap...@google.com> #58
Branch: androidx-main
commit 1237c1570308c6a5ad043702f5e9051c1c874602
Author: Zach Klippenstein <klippenstein@google.com>
Date: Thu Jan 27 19:41:29 2022
Report AndroidComposeView's focus rect to the view system.
ViewRootImpl controls panning when the keyboard is shown and the window
is configured to pan instead of resize. When it does this, it finds the
focused view and calls getFocusedRect to find the area to keep above the
keyboard. Because Compose has its own internal focus, it needs to report
that to the view system by overriding getFocusedRect in order to be
moved when the keyboard is shown.
I also factored out the keyboard helper methods from
CoreTextFieldSoftKeyboardTest so I could use them for the scrollable
tests.
Bug:
Bug:
Test: ./gradlew :compose:f:f:cDAT
Relnote: "TextFields will now be kept above the keyboard when they are
focused and the keyboard is shown, when the soft input mode is
`ADJUST_RESIZE`."
Change-Id: I8eaebb684b7828dcf92b0678a86d796b49b349c8
M compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/CoreTextFieldSoftKeyboardTest.kt
M compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/platform/AndroidComposeView.android.kt
A compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/CoreTextFieldKeyboardScrollableInteractionTest.kt
A compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/TextFieldsInScrollableDemo.kt
A compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/focus/FocusViewInteropTest.kt
M compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/TextDemos.kt
A compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/KeyboardHelper.kt
ap...@google.com <ap...@google.com> #59
Branch: androidx-main
commit a5c92f31181087df9a6a7100111d4248b94e75d4
Author: Zach Klippenstein <klippenstein@google.com>
Date: Fri Jan 28 12:36:11 2022
Change CoreTextField to use BringIntoViewRequester.
CoreTextField needs to ensure the cursor is in the visible bounds of all
scrollable parents, including the one in the text field itself.
Originally, it tried doing this by going through some of the text
service abstractions and ultimately calling
`View.requestRectangleOnScreen`. However, composable parents also need
to be aware of the request, so the correct way to do this is to use the
relatively recent `BringIntoViewRequester`. I'm not sure why all the
indirection through text services was done, it isn't necessary and
obscures the code, so I just made `CoreTextField` directly call
`BringIntoViewRequester.bringIntoView()`. This helps with
but doesn't completely fix it, due to
Bug:
Fixes:
Test: Tested manually.
Test: Refactored TextFieldDelegate unit tests to use the new code path:
./gradlew :compose:f:f:test
Relnote: "`notifyFocusedRect` methods in `TextInputSession` and
`TextInputService` are now deprecated and won't be called. Use
`BringIntoViewRequester` instead."
Change-Id: Ia4302c5f6ee79eec30a9f42c149da8775e1ed57e
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/Focusable.kt
M compose/ui/ui-text/api/restricted_current.txt
M compose/foundation/foundation/benchmark/src/androidTest/java/androidx/compose/foundation/benchmark/text/TextFieldToggleTextTestCase.kt
M compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/text/input/TextInputServiceAndroid.android.kt
A compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text/TextFieldBringIntoViewTest.kt
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/TextFieldDelegate.kt
M compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/input/TextInputService.kt
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/CoreTextField.kt
M compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/text/TextFieldDelegateTest.kt
M compose/ui/ui-text/api/public_plus_experimental_current.txt
M compose/ui/ui-text/src/test/java/androidx/compose/ui/text/TextInputServiceTest.kt
M compose/ui/ui-text/api/current.txt
ap...@google.com <ap...@google.com> #60
Branch: androidx-main
commit b47ac54b27a3e77b40f672cbcd5a713f464a4d27
Author: Zach Klippenstein <klippenstein@google.com>
Date: Thu Feb 03 12:09:04 2022
Revert removing implementations of notifyFocusedRect.
The notifyFocusedRect methods on TextInputService and TextInputSession
were deprecated and had their implementations replaced by no-ops in the
change aosp/1959647. This was probably too aggressive, so this change
adds the old implementations back in but leaves them deprecated, in case
any third-party code was calling them. The implementations were actually
broken before, and this change doesn't try to fix them, it just restores
the previous broken behavior.
Discussion thread about revert:
Bug:
Bug:
Test: Old tests restored.
Change-Id: I385749b629fd35b72bd148122ab1ec0f6d4ffa96
M compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/input/TextInputService.kt
M compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/text/input/TextInputServiceAndroid.android.kt
M compose/ui/ui-text/src/test/java/androidx/compose/ui/text/TextInputServiceTest.kt
[Deleted User] <[Deleted User]> #61
il...@gmail.com <il...@gmail.com> #62
v....@gmail.com <v....@gmail.com> #63
It is probably fixed in
gu...@googlemail.com <gu...@googlemail.com> #64
I just tried it out. In a single text field it works now. But when I use for example two text fields and on IME action next on the first one I switch the focus to the next field via FocusRequester, the keyboards stays below the first text field and therefore hides the next one.
My assumption would have been that the keyboard would now automatically jump to the next, now focused field.
re...@gmail.com <re...@gmail.com> #65
I guess the problem was partially fixed, tested on version
Here are a few problems:
- The TextField does not get fully visible when using ImeAction (Previous or Next) and focusing in a TextField that is hidden under the keyboard
- The TextField does not get fully visible when the user types on the keyboard.
- Considering the scenario that the TextField was visible when focused, and the user scrolls the screen and start typing while the focused TextField is hidden.
il...@gmail.com <il...@gmail.com> #66
hi...@gmail.com <hi...@gmail.com> #67
I think there is a mistake on the release note of
The release notes say that the behavior of adjustResize
has been improved, but I think this is a mistake for adjustPan
.
According to adjustResize
, but that task still seems to be a
I actually tried it with the accompanist sample, but it only works well with adjustPan
.
Added on 2022/03/02
I just looked at the release notes, and the description is now fixed. Thanks to the person who fixed it.
ap...@google.com <ap...@google.com> #68
Branch: androidx-main
commit 0de2359ab6335c7680e54cdd7b7bae046df9cdae
Author: Zach Klippenstein <klippenstein@google.com>
Date: Tue Feb 22 18:59:29 2022
Update TextFieldsInScrollableDemo to enable toggling setDecorFitsSystemWindows.
Bug:
Bug:
Bug:
Test: manual, since this is just a demo change.
Change-Id: I94deb16188232d8fe2d87b97b27dd3b7f2d36f68
M compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/TextFieldsInScrollableDemo.kt
ap...@google.com <ap...@google.com> #69
Branch: androidx-main
commit 30ab5ff0d1840570f5628d9489b47ce118caa4a3
Author: Zach Klippenstein <klippenstein@google.com>
Date: Sat Jan 29 09:36:44 2022
Introduce onFocusBoundsChanged.
Design doc:
Note that this feature does not currently work with AndroidView (
that needs to be wired up in the ui module but this API is needed to fix
an issue in foundation, and I want to leave it as Experimental for now,
and we don't allow cross-module experimental access. When this modifier
is stabilized, it should be moved to UI, and that bug resolved.
Bug:
Bug:
Bug:
Test: Manual via FocusedChildDemo
Test: ./gradlew :compose:f:f:cDAT
Relnote: "Introduced experimental `Modifier.onFocusedBoundsChanged` to allow
observing the bounds of child focusables."
Change-Id: I14283393b5273527ab65f4aa1a2d4383321b0d95
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/Focusable.kt
M compose/foundation/foundation/api/public_plus_experimental_current.txt
M compose/foundation/foundation/api/current.txt
M compose/foundation/foundation/api/restricted_current.txt
A compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/FocusedBounds.kt
A compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/FocusedBoundsDemo.kt
A compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/FocusableBoundsTest.kt
M compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/FoundationDemos.kt
sa...@gmail.com <sa...@gmail.com> #70
<activity android:windowSoftInputMode="adjustResize">
Column(modifier = Modifier.wrapContentHeight().navigationBarsWithImePadding())
pa...@7p-group.com <pa...@7p-group.com> #71
Concerning that workaround:
You can get rid of that hacky delay
with an OnGlobalLayoutListener
which will observe the actual IME rect size and will be triggered when the soft keyboard is fully visible.
A basic example could look like this:
val bringIntoViewRequester = remember { BringIntoViewRequester() }
val scope = rememberCoroutineScope()
val view = LocalView.current
DisposableEffect(view) {
val listener = ViewTreeObserver.OnGlobalLayoutListener {
scope.launch { bringIntoViewRequester.bringIntoView() }
}
view.viewTreeObserver.addOnGlobalLayoutListener(listener)
onDispose { view.viewTreeObserver.removeOnGlobalLayoutListener(listener) }
}
OutlinedTextField(
modifier = Modifier.bringIntoViewRequester(bringIntoViewRequester),
...
)
However additional view logic will be needed for it to work with multiple TextField
s.
¯\_(ツ)_/¯
te...@gmail.com <te...@gmail.com> #72
I'm currently using the following workaround :
@OptIn(ExperimentalFoundationApi::class)
// TODO Remove this workaround once they fix the issue
fun Modifier.bringIntoViewOnFocus(
source: MutableInteractionSource? = null,
extraOffset: Float = 0f,
): Modifier = composed {
var layoutCoordinates by remember { mutableStateOf<LayoutCoordinates?>(null) }
val requester = remember { BringIntoViewRequester() }
val isKeyboardShown = LocalWindowInsets.current.ime.isVisible
val isSourceFocused = source?.collectIsFocusedAsState()?.value ?: false
val focusModifier = when (source) {
null -> {
val scope = rememberCoroutineScope()
Modifier.onFocusEvent { state ->
if (state.isFocused && isKeyboardShown) {
scope.launch {
requester.bringIntoView(layoutCoordinates, extraOffset)
}
}
}
}
else -> Modifier
}
if (isSourceFocused && isKeyboardShown) {
LaunchedEffect(Unit) {
requester.bringIntoView(layoutCoordinates, extraOffset)
}
}
Modifier
.onGloballyPositioned { layoutCoordinates = it }
.bringIntoViewRequester(requester)
.then(focusModifier)
}
@OptIn(ExperimentalFoundationApi::class)
private suspend fun BringIntoViewRequester.bringIntoView(
coordinates: LayoutCoordinates? = null,
offset: Float = 0f,
) {
val position = coordinates?.size?.toSize()?.toRect()
val adjusted = position?.copy(
top = position.top + offset,
bottom = position.bottom + offset
)
bringIntoView(adjusted)
}
You can pass in MutableInteractionSource
or it will default to Modifier.onFocusEvent
+ an extra offset in case the bottom navigation gets in the way. I'm sure it's not the best solution but it seems to work ok.
Usage :
val extraOffset = with(LocalDensity.current) {
BottomHeight.toPx()
}
OutlinedTextField(
value = "test",
onValueChange = { },
modifier = Modifier.bringIntoViewOnFocus(extraOffset = extraOffset),
)
ap...@google.com <ap...@google.com> #73
Branch: androidx-main
commit d9c6260e0ecaab7b33ecda95611d60e3184a0fa4
Author: Zach Klippenstein <klippenstein@google.com>
Date: Mon Jan 31 09:46:32 2022
Make scrollable keep focused view in view when resized.
This is part of the fix for these bugs, another other part is aosp/1964580.
This behavior still doesn't work as expected for lazy lists because the
focused item can be removed due to the resize before it has a chance to
be scrolled into view. Ralston's working on the necessary functionality
to fix this.
Design doc:
Bug:
Bug:
Fixes:
Test: ./gradlew :compose:f:f:cDAT
Relnote: "Scroll modifiers (`Modifier.verticalScroll()`,
`Modifier.horizontalScroll()`, and `Modifier.scrollable()`)
will now scroll to keep the focused composable visible if
the scroll area is resized and the focused composable was
previously visible."
Relnote: "TextFields will now be kept above the keyboard when they are
focused and the keyboard is shown, when inside a non-lazy
scrollable and the soft input mode is `ADJUST_RESIZE`."
Change-Id: I4a485a1c80aa2d500dcd55e916006903ff45da95
A compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/ScrollableFocusableInteractionTest.kt
M compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/FoundationDemos.kt
A compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/ScrollableFocusedChildDemo.kt
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/Scrollable.kt
cr...@gmail.com <cr...@gmail.com> #74
ni...@gmail.com <ni...@gmail.com> #76
I still have issue with 1.2.0-alpha05, ADJUST_PAN and Landscape Orientation :
@Composable
private fun Screen() {
var textValue by remember {
mutableStateOf("")
}
Surface(Modifier.fillMaxSize()) {
Column(
horizontalAlignment = Alignment.CenterHorizontally, verticalArrangement = Arrangement.Center,
modifier = Modifier.fillMaxSize()
) {
Text(
text = "Title",
style = MaterialTheme.typography.h4,
textAlign = TextAlign.Start,
modifier = Modifier
.fillMaxWidth()
.fillMaxHeight(0.3f)
)
Spacer(modifier = Modifier.height(4.dp))
Text(
text = "Text\nTwo line",
style = MaterialTheme.typography.body2,
textAlign = TextAlign.Start,
modifier = Modifier
.fillMaxWidth()
.fillMaxHeight(0.2f)
)
Spacer(modifier = Modifier.height(16.dp))
TextField(
textStyle = MaterialTheme.typography.body2,
value = textValue,
onValueChange = {
textValue = it
},
modifier = Modifier
.fillMaxWidth()
.fillMaxHeight(),
colors = TextFieldDefaults.textFieldColors(
backgroundColor = Color.Blue,
textColor = MaterialTheme.colors.onSurface,
focusedIndicatorColor = MaterialTheme.colors.onSurface,
unfocusedIndicatorColor = Color.Transparent,
cursorColor = MaterialTheme.colors.onSurface
)
)
}
}
}
Click on the TextField and the field will be behind the keyboard. Be sure to force the orientation in landscape :
<activity
android:name=".MainActivity"
android:configChanges="keyboardHidden|uiMode|screenSize|screenLayout|orientation|colorMode|density|fontScale|fontWeightAdjustment|keyboard|layoutDirection|locale|mcc|mnc|navigation|smallestScreenSize|touchscreen"
android:exported="true"
android:label="@string/app_name"
android:launchMode="singleTop"
android:screenOrientation="landscape"
android:theme="@style/Theme.ComposeTextFieldLandscapeTest"
android:windowSoftInputMode="adjustPan">
Is it expected or still a bug ? It works if we adjust a vertical padding on Column (basically if the TextField is small "enough", it will be displayed above the keyboard). Maybe the issue is that the field is too big to be displayed above so it doesn't "scroll" to it ?
I'll push my sample on Github if required.
li...@gmail.com <li...@gmail.com> #77
What is the recommended workaround for this issue? I tried some of the ones posted above but it seems they have limitations and do not always work in my case.
co...@protonmail.com <co...@protonmail.com> #78
The fix should be in for non-lazy column in 1.2.0-alpha06
As per
"TextFields will now be kept above the keyboard when they are focused and the keyboard is shown, when inside a non-lazy scrollable and the soft input mode is ADJUST_RESIZE. (I4a485,
an...@gmail.com <an...@gmail.com> #79
I have this in the manifest:
<activity
android:windowSoftInputMode="adjustResize"
The Composable is inside a non-lazy scrollable like this:
Column(Modifier.verticalScroll(rememberScrollState())) {
OutlinedTextField(.....
Am I missing something else to get it to work?
be...@yescapa.com <be...@yescapa.com> #80
Or it is still required by accompagnist for edge to edge effect.
Am I missing something?
I checked the sample :
compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/text/TextFieldsInScrollableDemo.kt
And it's not working properly neither when setting off decor fits system windows and keyboard to ADJUST_RESIZE.
sl...@gmail.com <sl...@gmail.com> #81
My layout is
==== Header ====
--- scrollable column ---
==== Bottom Bar ====
If I set WindowCompat.setDecorFitsSystemWindows(window, false) then the text field in the scrollable column doesn't stay on screen
If I remove WindowCompat.setDecorFitsSystemWindows(window, false) and have ADJUST_RESIZE then the bottom controls are not covered by the IME
jo...@gmail.com <jo...@gmail.com> #82
ni...@google.com <ni...@google.com> #83
Compose status update: Please update the Status
and Status Summary
fields of this bug! (or Public Status
/Public Status Summary
)
te...@gmail.com <te...@gmail.com> #84
1.2.0-alpha07
works for me even with WindowCompat.setDecorFitsSystemWindows(window, false)
- I'm listening for insets in the activity and adding the ime ones as a bottom padding for the content FrameLayout findViewById(android.R.id.content)
.
My only question is how to specify an extra offset to scroll additionally when keyboard appears? Say you have a bottom navigation that may get in the way or implemented toolbar quick return pattern as the user scrolls and using offset on the scaffold content?
to...@gmail.com <to...@gmail.com> #85
kl...@google.com <kl...@google.com> #86
I can repro the case where adding newlines until the cursor goes below the IME does not cause a scroll, but that's a separate issue so I've filed it as
I can't repro the issue reported in #81. What device/android version/IME are you seeing this with?
ni...@gmail.com <ni...@gmail.com> #87
Should I report #76 in another issue ? it still happens in 1.2.0-alpha07 ; basically the text still goes below the IME if the TextField is too large to be visible entirely in the Rect above the IME. I have a working sample in the comment.
kl...@google.com <kl...@google.com> #88
Isn't that the same as
kl...@google.com <kl...@google.com> #89
Ok I can repro #81 on my Pixel 3 – ADJUST_RESIZE
, not fitting system windows. Will investigate.
kl...@google.com <kl...@google.com> #90
Filed the issue in #81 as
nu...@gmail.com <nu...@gmail.com> #91
Looks like compose won't be usable in production in another next year.
di...@gmail.com <di...@gmail.com> #92
This is unfair. Compose issues are getting worked on, and at a good pace (contrary to many AOSP core bugs).
This one was one of the more complex ones and I guess it was delayed due to priorities which to me seem more or less reasonable.
And Compose is very usable in production, we have already released several rather complex apps which use it extensively.
nu...@gmail.com <nu...@gmail.com> #93
What you doing, when QA, or (which is more scare) customer report that as problem? Tell them about other's p4 priorities on meetaps? Even when there are examples nearby that do not have such problems?
I'm even not talking about dozens of wasted hours to discover that there are no workarounds.
And users see that and treating it as a your bug. All of that lead to reputation loss at best.
We're talking about edittext, one of the basic elements for building a view. And it's problematic. As profesiional, i dont want to build to my customers buildings form crumbling bricks, whose manufacturer says "i fix it... well, maybe after all other things. Not important". I build it from bricks without that problems (because there are many problems other than multiline text editing)
On current stage compose is too fraught with loss of reputation, time and money, when you discover that things, no one which talking about in their "i use compose, and my life became better, hair became thicker, and blablabla" articles. And things gets even worse, when its you who advise command start new project on this. Problems and delays start to scale.
Its just not practical to waste no yourself money/time, no money of people, which paid your fo work and solutions.
di...@gmail.com <di...@gmail.com> #94
All issues we've run into with QA (including this one) were fixable with workarounds. Also Compose devs provide good support/advice on them in kotlinlang's slack #compose channel. And doing workarounds for Compose issues is a lot more easier/pleasant than doing ones for a View-based system.
Anyways, I think this is not the discussion for the issue tracker.
sa...@gmail.com <sa...@gmail.com> #95
it's not production ready at all. also adding workaround is not easy.
If you are using some framework, it should work as expected.
You shouldn't learn internals of that framework and work lots of days to fix issues in framework.
This edit text and keyboard behaviour is a basic thing.
They should have moved it to stable only after fixing such basic issues.
They are hurried up. Some internal politics probably. CameraX is a good example.
They have kept it in beta for a long time. Like that, they should have kept compose in beta until those issues are getting resolved.
sk...@gmail.com <sk...@gmail.com> #96
Powerful tools may come with a bit of a steep learning curve (and to be honest, Compose ain't all that hard), but once that's done, you benefit from amazing possibilities and powers.
Regarding bugs, I don't see how Compose is any more buggy than the View system. As with any complex project, bugs are simply inevitable. It is indeed a new thing, and may still need some work to mature, but that's why there's Compose/View interop.
I use Compose mainly and I barely have to fix anything. If I don't like a default behavior, I don't have to sift through a 1000-line Custom View Java file, but I can simply copy the underlying Composable function, which is usually very simple and easy to understand, and change whatever I want easily.
And yes, I've already produced some rather complex apps with Compose, and actually used it for some weird use cases that I think are simply too hard to be worth it with Views, and yet Compose helped me create them reliably and easily exactly as I wanted (and even more than I wanted) down to individual pixels and even the small nuances in animations, shapes, and behavior, with code that's maintainable, short, and dare I say it, beautiful.
And at the end of the day, if you don't like it, don't use it. Google did not force anyone to use Compose, and all of its hype is well-deserved, aired by the Android Developer community at large.
Anyways, this is not the place to fight over this. If you have anything to help with this specific issue, you're welcome to provide your feedback. Otherwise you can go on Twitter or Reddit and do destructive criticism as much as you please, while developers here are building the next big thing.
kl...@google.com <kl...@google.com> #97
I don't have any updates about fixes yet, but I understand the frustration about this issue and it is definitely being worked on. It's not actually a P4 – the "Priority" field on buganizer is very misleading, it has a very specific internal meaning and interaction with other systems so we don't use it for actual prioritization for compose text issues. Unfortunately, the way we track actual priority is not visible externally.
sa...@gmail.com <sa...@gmail.com> #98
ja...@gmail.com <ja...@gmail.com> #99
sh...@gmail.com <sh...@gmail.com> #100
//Library
implementation("com.google.accompanist:accompanist-insets:0.24.9-beta")
//Add this to your activity In AndroidManifest
android:windowSoftInputMode="stateVisible|adjustResize">
//Just add contentPadding in LazyColumn as -
LazyColumn(
contentPadding = rememberInsetsPaddingValues(
insets = LocalWindowInsets.current.systemBars,
applyTop = true,
applyBottom = true,
)
) {
//TextField and other widgets
}
bl...@gmail.com <bl...@gmail.com> #101
I'm using 1.2.0-beta03
and trying to make this work for a TextField
inside a Row
.
Even while using one of the workarounds, the functionality doesn't work most of the time in landscape mode, and seems to not work in certain cases in portrait mode (perhaps when the keyboard pops up a second or later time and making certain types of edits).
@OptIn(ExperimentalFoundationApi::class, ExperimentalComposeUiApi::class)
@Composable
fun EnterText() {
Row(
modifier = Modifier
.fillMaxWidth(),
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.Center,
)
{
val relocation = remember { BringIntoViewRequester() }
val scope = rememberCoroutineScope()
var thoughts by rememberSaveable { mutableStateOf("") }
TextField(
value = thoughts,
modifier = Modifier
.weight(1f)
.bringIntoViewRequester(relocation)
.onFocusEvent {
if (it.isFocused) scope.launch { delay(300); relocation.bringIntoView() }
},
label = { Text(text = "Enter text") },
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Text),
onValueChange = { newText ->
thoughts = newText
}
)
}
}
xa...@gmail.com <xa...@gmail.com> #102
kl...@google.com <kl...@google.com> #103
Nothing to announce yet, but we are working very actively on this.
ab...@gmail.com <ab...@gmail.com> #104
Please try to fix this on Priority, as going for hit & trial several times with the code and even after that not getting the expected workable solution is frustrating.
he...@gmail.com <he...@gmail.com> #105
wi...@azimo.com <wi...@azimo.com> #106
si...@gmail.com <si...@gmail.com> #107
Read the comment number 40. I use this workaround in production, with about 1M users.
da...@gmail.com <da...@gmail.com> #108
I realized I never posted my workaround for this.
It's actually on an old version of Compose but used to work very reliably
val relocationRequester = remember { RelocationRequester() }
var focused by remember { mutableStateOf(false) }
val ime = LocalWindowInsets.current.ime
LaunchedEffect(focused) {
if (focused) {
var done = false
while (!done) {
if (ime.isVisible && !ime.animationInProgress) {
relocationRequester.bringIntoView()
done = true
}
delay(100L)
}
}
}
TextField(
modifier = Modifier
// ...
.onFocusChanged { focused = it }
// ...
)
I'm not sure if it still works with latest version because I didn't need it in recent projects yet and I haven't been working on the other one for several months.
I first posted it in this slack conversation
ar...@gmail.com <ar...@gmail.com> #109
xa...@gmail.com <xa...@gmail.com> #110
re...@googlemail.com <re...@googlemail.com> #111
wa...@gmail.com <wa...@gmail.com> #112
Let's say I have a sticky footer (bottom navigation) , Now when I type the text field will go below the bottom navigation even though I want it to be above it , so please fix that as well !
st...@google.com <st...@google.com> #113
#112 you think it's worth creating a new issue with a repro on that and we can link to this bug if they're related? just to add to the test cases to verify
wa...@gmail.com <wa...@gmail.com> #114
#113 Yeah , great !
wa...@gmail.com <wa...@gmail.com> #116
I have a question , Do I need to use BringIntoViewRequester or the textfield will be kept in view without me writing any code ? Like Do I need to do anything ?
il...@gmail.com <il...@gmail.com> #117
il...@gmail.com <il...@gmail.com> #118
st...@google.com <st...@google.com> #119
Hi there. This issue is not dead, and it is not fixed in production yet. It remains high priority for us and we're actively working on fixing it. However it is caused by a very complex combination of dependencies and the fix is not trivial. We've most recently been focusing on
ap...@google.com <ap...@google.com> #120
Branch: androidx-main
commit 7e77bb541331ce0d62cabad732e43eca41ac978a
Author: Zach Klippenstein <klippenstein@google.com>
Date: Wed Jul 06 11:42:21 2022
Move BringIntoView queueing into the scrollable implementation.
This change removes the over-complicated coroutine-based queuing of
bringIntoView requests in the BringIntoViewResponder, which now is only
responsible for dispatching the request to the actual responder
interface and propagating it up the modifier local chain.
This gives the actual responder implementation (i.e. in
Modifier.scrollable) all the information about conflicting
requests and manage the queue of ongoing requests with an actual,
explicit queue that is much more straightforward than the previous
coroutine job chaining mess. Each request is stored in an actual list
along with the continuation from the request, and requests are
explicitly resumed or cancelled when needed. This also makes debugging
easier, because there's an actual queue data structure we can inspect,
which contains all the actual information about each request.
It also completely changes how the scroll animation is performed.
On every frame, the scroll target is recomputed to account for
changes in the viewport size, the request size, or the set of active
requests since the last frame, while still keeping the animation
smooth. The animation logic is in its own class, which allows a single
suspend animation call to animate to a target value that can be updated
while the animation is running.
While this change is a valuable cleanup on its own, it also fixes
focused child tracking with an explicit API for keeping a thing in view.
Fixes:
Bug:
Bug:
Bug:
Bug:
Test: ScrollableFocusableInteractionTest
Test: androidx.compose.foundation.relocation.*
Test: RebasableAnimationStateTest
Test: BringIntoViewRequestPriorityQueueTest
Relnote: "Rewrote the way scrollables respond to
`bringIntoViewRequesters` and focusables to better model the
complexity of those operations and handle more edge cases."
Change-Id: I2e5fec8c8582a8fe1f191e37fd0f4f9165678664
M compose/foundation/foundation/api/current.txt
M compose/foundation/foundation/api/public_plus_experimental_current.txt
M compose/foundation/foundation/api/restricted_current.txt
M compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/FoundationDemos.kt
M compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/ScrollableFocusedChildDemo.kt
A compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/relocation/BringIntoViewResponderDemo.kt
M compose/foundation/foundation/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/relocation/BringRectangleIntoViewDemo.kt
M compose/foundation/foundation/samples/src/main/java/androidx/compose/foundation/samples/BringIntoViewSamples.kt
M compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/ScrollableFocusableInteractionTest.kt
M compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/list/LazyListFocusMoveTest.kt
M compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/relocation/BringIntoViewResponderTest.kt
M compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/relocation/BringIntoViewScrollableInteractionTest.kt
A compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/BringIntoViewRequestPriorityQueue.kt
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/ContentInViewModifier.kt
A compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/gestures/UpdatableAnimationState.kt
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/relocation/BringIntoViewResponder.kt
A compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/gestures/BringIntoViewRequestPriorityQueueTest.kt
A compose/foundation/foundation/src/test/kotlin/androidx/compose/foundation/gestures/UpdatableAnimationStateTest.kt
kl...@google.com <kl...@google.com> #121
Major fixes to this were just released in 1.4.0-alpha04. Text fields in lazy columns should work now too. One notable case that is still being worked on is if
ja...@gmail.com <ja...@gmail.com> #122
ATAL EXCEPTION: main
Process: com.example.textboxresearch, PID: 15827
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:558)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at androidx.compose.ui.tooling.ComposableInvoker.invokeComposableMethod(ComposableInvoker.kt:163)
at androidx.compose.ui.tooling.ComposableInvoker.invokeComposable(ComposableInvoker.kt:203)
at androidx.compose.ui.tooling.PreviewActivity$setComposableContent$2.invoke(PreviewActivity.kt:77)
at androidx.compose.ui.tooling.PreviewActivity$setComposableContent$2.invoke(PreviewActivity.kt:76)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:107)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34)
at androidx.compose.ui.platform.ComposeView.Content(ComposeView.android.kt:428)
at androidx.compose.ui.platform.AbstractComposeView$ensureCompositionCreated$1.invoke(ComposeView.android.kt:252)
at androidx.compose.ui.platform.AbstractComposeView$ensureCompositionCreated$1.invoke(ComposeView.android.kt:251)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:107)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34)
at androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:228)
at androidx.compose.ui.platform.CompositionLocalsKt.ProvideCommonCompositionLocals(CompositionLocals.kt:177)
at androidx.compose.ui.platform.AndroidCompositionLocals_androidKt$ProvideAndroidCompositionLocals$3.invoke(AndroidCompositionLocals.android.kt:123)
at androidx.compose.ui.platform.AndroidCompositionLocals_androidKt$ProvideAndroidCompositionLocals$3.invoke(AndroidCompositionLocals.android.kt:122)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:107)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34)
at androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:228)
at androidx.compose.ui.platform.AndroidCompositionLocals_androidKt.ProvideAndroidCompositionLocals(AndroidCompositionLocals.android.kt:114)
at androidx.compose.ui.platform.WrappedComposition$setContent$1$1$3.invoke(Wrapper.android.kt:157)
at androidx.compose.ui.platform.WrappedComposition$setContent$1$1$3.invoke(Wrapper.android.kt:156)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:107)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34)
at androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:228)
at androidx.compose.ui.platform.WrappedComposition$setContent$1$1.invoke(Wrapper.android.kt:156)
at androidx.compose.ui.platform.WrappedComposition$setContent$1$1.invoke(Wrapper.android.kt:140)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:107)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34)
at androidx.compose.runtime.ActualJvm_jvmKt.invokeComposable(ActualJvm.jvm.kt:78)
at androidx.compose.runtime.ComposerImpl$doCompose$2$5.invoke(Composer.kt:3314)
at androidx.compose.runtime.ComposerImpl$doCompose$2$5.invoke(Composer.kt:3304)
at androidx.compose.runtime.SnapshotStateKt__DerivedStateKt.observeDerivedStateRecalculations(DerivedState.kt:341)
at androidx.compose.runtime.SnapshotStateKt.observeDerivedStateRecalculations(Unknown Source:1)
2023-01-12 17:38:35.171 15827-15827 AndroidRuntime com.example.textboxresearch E at androidx.compose.runtime.ComposerImpl.doCompose(Composer.kt:3304)
at androidx.compose.runtime.ComposerImpl.composeContent$runtime_release(Composer.kt:3239)
at androidx.compose.runtime.CompositionImpl.composeContent(Composition.kt:587)
at androidx.compose.runtime.Recomposer.composeInitial$runtime_release(Recomposer.kt:967)
at androidx.compose.runtime.CompositionImpl.setContent(Composition.kt:519)
at androidx.compose.ui.platform.WrappedComposition$setContent$1.invoke(Wrapper.android.kt:140)
at androidx.compose.ui.platform.WrappedComposition$setContent$1.invoke(Wrapper.android.kt:131)
at androidx.compose.ui.platform.AndroidComposeView.setOnViewTreeOwnersAvailable(AndroidComposeView.android.kt:1089)
at androidx.compose.ui.platform.WrappedComposition.setContent(Wrapper.android.kt:131)
at androidx.compose.ui.platform.WrappedComposition.onStateChanged(Wrapper.android.kt:182)
at androidx.lifecycle.LifecycleRegistry$ObserverWithState.dispatchEvent(LifecycleRegistry.kt:314)
at androidx.lifecycle.LifecycleRegistry.addObserver(LifecycleRegistry.kt:192)
at androidx.compose.ui.platform.WrappedComposition$setContent$1.invoke(Wrapper.android.kt:138)
at androidx.compose.ui.platform.WrappedComposition$setContent$1.invoke(Wrapper.android.kt:131)
at androidx.compose.ui.platform.AndroidComposeView.onAttachedToWindow(AndroidComposeView.android.kt:1176)
at android.view.View.dispatchAttachedToWindow(View.java:20753)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3490)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3497)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3497)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3497)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3497)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2613)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:2126)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:8658)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1037)
at android.view.Choreographer.doCallbacks(Choreographer.java:845)
at android.view.Choreographer.doFrame(Choreographer.java:780)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1022)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.app.ActivityThread.main(ActivityThread.java:7839)
... 3 more
Caused by: java.lang.NoSuchFieldError: No static field $stable of type I in class Landroidx/compose/foundation/text/KeyboardActions; or its superclasses (declaration of 'androidx.compose.foundation.text.KeyboardActions' appears in /data/app/~~TC_W8Fki2PnCjomqRoVwJA==/com.example.textboxresearch-Ekc572auvJyczWtc91Ptug==/base.apk)
at androidx.compose.material.TextFieldKt.TextField(TextField.kt:207)
at com.example.textboxresearch.TestKt.CheckTest(Test.kt:29)
... 70 more
st...@google.com <st...@google.com> #123
You mean an OutlinedTextField? Can you share the snippet?
ja...@gmail.com <ja...@gmail.com> #124
kl...@google.com <kl...@google.com> #125
Can you please attach a video of BasicTextField
still going under the IME? And repro code if possible.
ja...@gmail.com <ja...@gmail.com> #126
kl...@google.com <kl...@google.com> #127
Ah, that's
wa...@gmail.com <wa...@gmail.com> #128
I am getting the same crash , waiting for next release , please release that fast
bl...@gmail.com <bl...@gmail.com> #129
Major fixes to this were just released in 1.4.0-alpha04
Major bugs were also released...
java.lang.NoSuchFieldError: No static field $stable of type I in class Landroidx/compose/foundation/text/KeyboardActions; or its superclasses (declaration of 'androidx.compose.foundation.text.KeyboardActions' appears in /data/app/~~xxx/base.apk)
at androidx.compose.material3.TextFieldKt$TextField$5.invoke(TextField.kt:343)
at androidx.compose.material3.TextFieldKt$TextField$5.invoke(TextField.kt:323)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:107)
at androidx.compose.runtime.internal.ComposableLambdaImpl.invoke(ComposableLambda.jvm.kt:34)
at androidx.compose.runtime.CompositionLocalKt.CompositionLocalProvider(CompositionLocal.kt:228)
at androidx.compose.material3.TextFieldKt.TextField(TextField.kt:323)
st...@google.com <st...@google.com> #130
The crash above is reported here with workaround:
wa...@gmail.com <wa...@gmail.com> #131
so I upgraded to material 3 alpha04 and now I am not getting the Crash BUT I am still getting the text field going under the keyboard , I will post a video about it My TextField does take full width , is multiline but unless the user presses enter , it remains single lined , When I tap on the text field , the keyboard comes from underneath and stays on top of the field I don't use BringIntoViewRequester or any other code to bring it into view , I expect it to work magically.
ja...@gmail.com <ja...@gmail.com> #132
kl...@google.com <kl...@google.com> #133
Can you confirm you're also using Foundation version 1.4.0-alpha04? The bug was fixed in Foundation, not Material, and while material3 1.1.0-alpha04 should be using the latest alpha, I just want to make sure it actually is in your project. A video would be helpful, thanks.
ja...@gmail.com <ja...@gmail.com> #134
wa...@gmail.com <wa...@gmail.com> #135
I created a sample project and recorded this video , apparently the keyboard is opening and text field staying above when I tap on the field but not for long , when the text field becomes multiline , the text goes below keyboard
wa...@gmail.com <wa...@gmail.com> #136
This project using latest compose version
1.1.0-alpha04 for material 3
Compose version 1.4.0-alpha04 , UI , which should probably including foundation of the same version
kl...@google.com <kl...@google.com> #137
That's also
wa...@gmail.com <wa...@gmail.com> #138
So if I apply a fixed height , would it work ?
kl...@google.com <kl...@google.com> #139
Actually I think this might be a separate bug, since the resized field isn't internally scrollable. I filed
kl...@google.com <kl...@google.com> #140
We are closing this issue since the main case for this bug has been fixed: fixed-size text fields inside scrollable Column
s and LazyColumn
s will be kept above the keyboard when they gain focus and the keyboard becomes shown and would otherwise cover the field.
There are still some cases related to this that are still broken and being worked on, but those will be tracked in separate bugs going forward. The known remaining issues at this time are:
- Cursors in text fields that take all available space and are internally scrollable may disappear behind the keyboard (
)b/237190748 - Text fields that grow taller while being edited aren’t kept above the keyboard (
)b/266094055 - Crash with “No field $stable of type I in class Landroidx/compose/foundation/text/KeyboardActions” (
)b/265172081 - Text fields will stay below the keyboard when inside LazyVerticalGrid (
)b/265352893
Please follow those individual bugs for further updates.
If you find new issues, please
Description
If you put the Text Field Composable inside Lazy Column / Scrollable Column , Even After using the Insets / Content Padding on the Lazy Column / Scrollable Column
The Text goes below the keyboard Because Of The Scroll State
Since when the IME Opens the Ime comes above the Text And The Scroll State Would Remain the Same Lazy Column Wouldn't Scroll so the Text Would Remain Visible (Above Keyboard)