Status Update
Comments
lp...@google.com <lp...@google.com>
ap...@google.com <ap...@google.com> #2
Information redacted by Android Beta Feedback.
al...@jetbrains.com <al...@jetbrains.com> #3
Thank you for reporting this issue. We have shared this with our product and engineering team and will update this issue with more information as it becomes available.
be...@google.com <be...@google.com> #4
The issue has been fixed and watch out for future releases.
ap...@google.com <ap...@google.com> #5
What
More information
Lateral QPR build solved issue. No more freezes so far.
Where
Build and device data
- Build Number: google/panther_beta/panther:15/BP11.241121.013/12873528:user/release-keys
(Note: It is the build when sending this report. For exact build reference, please see the attached bugreport.)
Debugging information
Google Play services
com.google.android.gms
Version 244933035 (24.49.33 (260400-705592033))
System App (Updated)
Android System WebView
com.google.android.webview
Version 677826033 (131.0.6778.260)
System App (Updated)
Network operator: airtel
SIM operator: airtel
Filed by Android Beta Feedback. Version (Updated): 2.46-betterbug.external_20241023_RC01 (DOGFOOD)
To learn more about our feedback process, please visit
al...@jetbrains.com <al...@jetbrains.com> #6
Information redacted by Android Beta Feedback.
ap...@google.com <ap...@google.com> #7
Project: platform/frameworks/support
Branch: androidx-main
Author: Anton Beloglazov <
Link:
Fix a focus bug in the invalidation logic where incorrect focus events were sent when the active focus target node is a delegated node.
Expand for full commit details
Fix a focus bug in the invalidation logic where incorrect focus events
were sent when the active focus target node is a delegated node.
Bug: 395895685
Test: FocusEventCountTest
Change-Id: I9278a3e08bb4718c0601d153766f265105117ad3
Files:
- M
compose/ui/ui/src/androidInstrumentedTest/kotlin/androidx/compose/ui/focus/FocusEventCountTest.kt
- M
compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/focus/FocusInvalidationManager.kt
Hash: fcd264a09c71538829b7e146779babe638a9093a
Date: Wed Feb 26 18:23:56 2025
be...@google.com <be...@google.com> #8
I believe the last CL fixes the last remaining issue related to this use case.
I found that the issue of focus being "stolen" by the TextField
is caused by the fact that the pointerInput
modifier on the trailing icon does no consume the event. Since the event is not consumed, the TextField
handles it as well and requests the focus. To fix that, change awaitFirstDown()
to awaitFirstDown().also { it.consume() }
.
al...@jetbrains.com <al...@jetbrains.com> #9
Thanks! The bug no longer reproduces after cherry-picking these 3 commits to compose multiplatform.
be...@google.com <be...@google.com> #10
Great, thanks for confirming, Alexander!
na...@google.com <na...@google.com> #11
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.compose.ui:ui:1.8.0-rc01
androidx.compose.ui:ui-android:1.8.0-rc01
androidx.compose.ui:ui-jvmstubs:1.8.0-rc01
androidx.compose.ui:ui-linuxx64stubs:1.8.0-rc01
Description
Jetpack Compose version: 1.8.0-beta01
Jetpack Compose component used: TextField
Code Sample to Reproduce
Note that the
lineLimits
argument is there just to cause a recomposition ofTextField
, which triggers the bug. The line limits themselves are not related to the bug.Analysis
The problem appears to be with focus management; not the text field itself. The issue doesn't reproduce with
ComposeUiFlags.isTrackFocusEnabled = false
(although it seems to trigger a different issue - the text field steals the focus back on each click).The issue appears to be that when the "button" becomes focused,
TextFieldDecoratorModifierNode.onFocusEvent
receives an incorrect call (fromFocusInvalidationManager.invalidateNodesOptimized
) with aFocusState.Active
argument.Perhaps the algorithm in
FocusInvalidationManager.invalidateNodesOptimized
is incorrect? It goes up the modifier node tree, starting from the active focus target node, until it encounters the firstFocusTargetNode
infocusEventNodes
(means invalidated?), and then tells it that it isFocusState.Active
. In the case of the issue, we have is a chain like this:Now,
TextFieldDecoratorModifierNode
expects to be toldFocusState.Active
when theFocusTargetNode
of the text field is active. But the logic ofFocusInvalidationManager.invalidateNodesOptimized
is such that it will also receiveFocusState.Active
when theFocusTargetNode
of the button is active. This leads to confusion, because the text field itself is not focused at this point, butTextFieldDecoratorModifierNode
thinks that it is (isElementFocused
istrue
), and so it doesn't request focus on click.