https://kotlinlang.org logo
Title
c

Christopher Mederos

05/10/2023, 7:32 AM
Shouldn't clicking outside a textfield clear focus? Curious why this isn't standard behaviour for Material components
I suppose it's variable in the sampling of the apps installed on my own phone... Ultimately I guess it's better to have a clear next action, input, etc. for the user to progress towards, which will change the focus anyhow
e

ephemient

05/10/2023, 8:53 AM
it's default Android behavior: focus should move to something else that can take focus. apps that are clearing focus are doing something special
s

Stylianos Gakis

05/10/2023, 9:19 AM
Interestingly enough, I just yesterday happened to stumble upon this
clearFocusOnTap
modifier https://kotlinlang.slack.com/archives/CJLTWPH7S/p1682437025136049?thread_ts=1682337217.318679&cid=CJLTWPH7S and I tried it out in our app and it works perfectly fine. Just need to decide which component will be the one that bears that behavior, for us I slapped it into the background of the screen where I needed this behavior and it simply worked.
c

Christopher Mederos

05/12/2023, 5:23 AM
@Stylianos Gakis thanks for the headsup - I might give that a shot as well! @ephemient I agree that there should always be a next thing that receives focus. However, I've also noticed that in longer input forms, some users like to preview the whole form first, test some input to see what's possible, etc. In that situation, I've seen them taping on the screen to try to clear the keyboard in my app.