Tower Guidev2
05/24/2023, 2:24 PMTower Guidev2
05/24/2023, 2:30 PMval (usernameFocus, passwordFocus) = remember { FocusRequester.createRefs() }
LaunchedEffect(key1 = entranceState) {
if (entranceState.isValid()) doNothing()
else {
when {
entranceState.usernameError != null -> usernameFocus.requestFocus()
entranceState.passwordError != null -> passwordFocus.requestFocus()
}
}
}
my issue is that when both fields are in error and the username always gets focus, which is annoying users when they are attempting to fix the password value.
is there any way i can detect when the user is entering the password, e.g. the password field has focus so as not to request focus on the username field?