Status Update
Comments
ma...@google.com <ma...@google.com> #2
Wow, it seems like a very important bug to fix.
Doing some investigations...
It works fine with CoreTextField as well as BaseTextField.
so...@google.com <so...@google.com> #3
Seems to be a duplicate of
ma...@google.com <ma...@google.com> #4
It works fine with Material TextFields (both filled and outline) if you use TextFieldValue based overloads.
It doesn't work when you use String based overloads however (both Outline and Filled). I believe this is related to the one-frame lag as we host TextFieldValue internally and proxy only string.
ma...@google.com <ma...@google.com> #5
Chatted with Anastasia.
We have this code
// "value: String" comes as a param in TextField
TextFieldImpl(
type = TextFieldType.Outlined,
value = textFieldValue,
onValueChange = {
selection = it.selection
composition = it.composition
if (value != it.text) {
onValueChange(it.text)
}
},
and this value is always ""
for me, as it's captured my lambda when lambda was created and this lambda is saved and reused by CoreTextField.
Anyway, two things we can do:
- Remove this if and invoke
onValueChange
everytime, even on the selection change (which we don't care about). This will allow us to workaround quickly and not to let it slip through. - Find and implement the proper fix in CoreTextField
Let me know what you think
so...@google.com <so...@google.com> #6
Updated the details here
so...@google.com <so...@google.com> #7
Just a note that this issue affects String overrides of both material text fields as well as any custom String override text fields that developer might create on top of CoreTextField/BaseTextField.
si...@google.com <si...@google.com>
ap...@google.com <ap...@google.com> #8
Branch: androidx-master-dev
commit 1717097cfa889c564450626af6d5dcc405581d79
Author: Anastasia Soboleva <soboleva@google.com>
Date: Mon Aug 24 16:38:59 2020
Fix lambda value being captured for string override text fields
Fixes: 163834907
Fixes: 163808219
Fixes: 165956313
Test: new test in TextFieldTest#stringOverrideTextField_canDeleteLastSymbol
Test: foundation and material tests passed
Change-Id: I9932a2bddc3859a2a35a54e0b6d7cb525853d3ac
M compose/foundation/foundation-text/src/commonMain/kotlin/androidx/compose/foundation/text/CoreTextField.kt
M compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/TextFieldTest.kt
vi...@airbnb.com <vi...@airbnb.com> #9
Which release is this fix going to be a part of? Also, what's the best way to know which version a change will be a part of in general?
so...@google.com <so...@google.com> #10
This fix will be available in the upcoming release.
As for the second question, I'm not sure I've got a good answer for that one. I'd say normally if it's marked as fixed, it'll be available within two next releases.
Description
1-function repro :)
TextField works as expected until user presses backspace to remove last character. setText is not called, but the cursor position is modified.
Selecting the text and using
cut
does cause setText to be cleared.Thanks!