https://kotlinlang.org logo
#compose
Title
# compose
d

dazza5000

03/06/2023, 8:47 PM
I have a talkback/ accessibility issue where the error is not read out on a textfield if there is a LoadingDialog shown, instead the button will steal the focus and interrupt the textfield error being read out: Code and videos in thread
Copy code
setContent {

            val error = remember { mutableStateOf("") }
            val isError = remember { mutableStateOf(false) }
            val isLoading = remember { mutableStateOf(false) }
            val value = remember { mutableStateOf(TextFieldValue("")) }

            MyApplicationTheme {
                // A surface container using the 'background' color from the theme
                Scaffold(
                    bottomBar = {
                        Button({
                            isLoading.value = true
//
                            GlobalScope.launch {
//                                delay(500L)
                                isError.value = !isError.value
                                error.value =
                                    if (isError.value) "please complete this field" else ""

                                isLoading.value = false
                            }
                        }) {
                            Text("Button")
                        }
                    }
                ) { paddingValues ->
                    Column(modifier = Modifier.padding(paddingValues)) {
                        LoadingDialog(showLoadingDialog = isLoading.value)

                        OutlinedTextField(
                            value = value.value,
                            onValueChange = { updated: TextFieldValue -> value.value = updated },
                            modifier = Modifier.semantics {
                                liveRegion = LiveRegionMode.Polite
                            },
                            isError = isError.value,
                            label =  { if (isError.value) Text(error.value) else null }
                        )
                        TextFieldSample(
                            value = TextFieldValue(""),
                            onValueChange = {
                                value.value = it
                            },
                            label = "text field test three"
                        )

                    }
                }
            }
        }
with loading dialog the error is interrupted while being read
without the loading dialog the error is read out completely
78 Views