The docs for `AmbientAutofillTree` note that Autof...
# compose
The docs for
note that Autofill semantics will be replacing some of the existing autofill APIs at some point, but reference an internal issue and the comment itself seems to be over a year old. Is the plan still to leverage semantics for some of the autofill support? Ref:[…]compose/ui/platform/Ambients.kt;l=58-65?q=AmbientAutofillTree
Mostly curious because while the current approach works, it’s a bit clunky and at the very least I’d expect something like this `Autofill` composable to become part of the public API
cc @Ralston Da Silva
Hi Bryan, thanks for asking. Yes that comment is pretty old. Our current thoughts are that the Autofill API will use modifiers. Here is an example of what the API might end up looking like:
Copy code
   text = text, 
   modifier = Modifier
       .autofillProperties {
           autofillDataType = AutofillDataType.Text
           autofillType = AutofillType.EmailAddress
       .onAutofill{ text = it }
For components that we provide, we will provide the onAutofill modifier internally, and populate default autofill properties. The users can override the properties to change them:
Copy code
var name by remember { mutableStateOf("enter email address here") }
   text = name,
   onValueChanged = { text = it }
   modifier = Modifier.autofillProperties { 
       autofillType = listOf(AutofillType.EmailAddress)
The existing API is just a placeholder, but when we re-visit autofill, it might look something like this. Would love to hear your feedback!
Thanks @Ralston Da Silva, that’s exactly what I was hoping to see for autofill!!
I imagine that with Compose setting proper autofill types will be more important than with the View framework since the autofill services won’t have as much context to use to infer types
Yes that's right @Bryan Herbst, but we will still try to infer autofill types based on location on the screen (if it is close to a text label), and try to use accessibility properties if they are set.
Hi ! Any update on an upcoming Autofill API in Compose UI ? 🙂 thanks for your feedback and thanks @Bryan Herbst for your article on that subject
@Ralston Da Silva can I have a link to the tracking issue or MR for autofill?