fix(auth): Issues with focus and hardware keyboard on the login screen.

When using hardware keyboard on the login screen, focus would jump from
the input field to the back button, which resulted in navigating back.
This commit is contained in:
Mateusz Armatys
2025-04-22 16:13:33 +02:00
parent 06024061fc
commit 7b1bad5c68
4 changed files with 6 additions and 2 deletions
@@ -278,7 +278,7 @@ private fun PasswordForm(
ProtonPasswordOutlinedTextFieldWithError(
text = password,
onValueChanged = { password = it },
enabled = enabled,
readOnly = !enabled,
errorText = if (hasValidationError) "" else null,
requestFocus = { true },
onFocusChanged = { if (it) onPasswordInputFocused() },
@@ -315,7 +315,7 @@ private fun LoginForm(
textChange.value = textChange.value.second to new
username = new
},
enabled = enabled,
readOnly = !enabled,
errorText = if (hasValidationError) assistiveText else null,
requestFocus = { initialUsername == null },
onFocusChanged = { if (it) onUsernameInputFocused() },
@@ -135,6 +135,7 @@ fun ProtonOutlinedTextFieldWithError(
onValueChanged: (String) -> Unit,
trailingIcon: @Composable (() -> Unit)? = null,
visualTransformation: VisualTransformation = VisualTransformation.None,
readOnly: Boolean = false,
) {
val focusRequester = remember { FocusRequester() }
var textFieldLoaded by remember { mutableStateOf(false) }
@@ -144,6 +145,7 @@ fun ProtonOutlinedTextFieldWithError(
onValueChange = onValueChanged,
colors = TextFieldDefaults.protonOutlineTextFieldColors(),
enabled = enabled,
readOnly = readOnly,
isError = errorText != null,
keyboardOptions = keyboardOptions,
keyboardActions = keyboardActions,
@@ -73,6 +73,7 @@ fun ProtonPasswordOutlinedTextFieldWithError(
placeholder: (@Composable () -> Unit)? = null,
singleLine: Boolean = false,
onValueChanged: (String) -> Unit,
readOnly: Boolean = false,
) {
var passwordVisualTransformationEnabled by remember(passwordVisible) {
mutableStateOf(passwordVisible)
@@ -85,6 +86,7 @@ fun ProtonPasswordOutlinedTextFieldWithError(
onValueChange = onValueChanged,
colors = TextFieldDefaults.protonOutlineTextFieldColors(),
enabled = enabled,
readOnly = readOnly,
isError = errorText != null,
keyboardOptions = keyboardOptions,
keyboardActions = keyboardActions,