From d50f99e64c32af8d7a8d32c94f71ffec308acf01 Mon Sep 17 00:00:00 2001 From: topjohnwu Date: Sat, 24 Oct 2026 06:08:19 +0000 Subject: [PATCH] app: fix accessibility labels - The back buttons of the DenyList, flash and action screens, and the DenyList's clear search button, had no label, so TalkBack read them as unlabeled buttons. Label them like the other screens do. - A module's enable switch is its own accessibility node without the module name. Name it after the module. - The safe mode item in the reboot menu showed its state only with a check mark. Expose it as a toggleable state. - Navigation items and the module action and update buttons labeled their icons with the same text as their visible label, so it was read twice. Make those icons decorative. Assisted-by: Claude Opus 5.5 --- .../main/java/com/topjohnwu/magisk/ui/MainScreen.kt | 3 ++- .../com/topjohnwu/magisk/ui/deny/DenyListScreen.kt | 4 ++-- .../java/com/topjohnwu/magisk/ui/flash/FlashScreen.kt | 2 +- .../java/com/topjohnwu/magisk/ui/home/HomeScreen.kt | 7 +++++++ .../com/topjohnwu/magisk/ui/module/ActionScreen.kt | 2 +- .../com/topjohnwu/magisk/ui/module/ModuleScreen.kt | 10 +++++++--- 6 files changed, 20 insertions(+), 8 deletions(-) diff --git a/app/apk/src/main/java/com/topjohnwu/magisk/ui/MainScreen.kt b/app/apk/src/main/java/com/topjohnwu/magisk/ui/MainScreen.kt index 30f80aa44..1ea0f0f59 100644 --- a/app/apk/src/main/java/com/topjohnwu/magisk/ui/MainScreen.kt +++ b/app/apk/src/main/java/com/topjohnwu/magisk/ui/MainScreen.kt @@ -183,7 +183,8 @@ fun MainScreen( icon = { Icon( imageVector = ImageVector.vectorResource(tab.iconRes), - contentDescription = stringResource(tab.titleRes), + // The label below already names the tab + contentDescription = null, ) }, label = { Text(stringResource(tab.titleRes)) }, diff --git a/app/apk/src/main/java/com/topjohnwu/magisk/ui/deny/DenyListScreen.kt b/app/apk/src/main/java/com/topjohnwu/magisk/ui/deny/DenyListScreen.kt index e2e58527d..5d4dabd2d 100644 --- a/app/apk/src/main/java/com/topjohnwu/magisk/ui/deny/DenyListScreen.kt +++ b/app/apk/src/main/java/com/topjohnwu/magisk/ui/deny/DenyListScreen.kt @@ -119,7 +119,7 @@ fun DenyListScreen( ) { Icon( imageVector = Icons.AutoMirrored.Filled.ArrowBack, - contentDescription = null, + contentDescription = stringResource(CoreR.string.back), ) } }, @@ -219,7 +219,7 @@ private fun SearchInput( IconButton(onClick = { onQueryChange("") }) { Icon( imageVector = Icons.Default.Close, - contentDescription = null, + contentDescription = stringResource(CoreR.string.close), tint = MaterialTheme.colorScheme.onSurfaceVariant ) } diff --git a/app/apk/src/main/java/com/topjohnwu/magisk/ui/flash/FlashScreen.kt b/app/apk/src/main/java/com/topjohnwu/magisk/ui/flash/FlashScreen.kt index 971fd0f9a..d2f10b37a 100644 --- a/app/apk/src/main/java/com/topjohnwu/magisk/ui/flash/FlashScreen.kt +++ b/app/apk/src/main/java/com/topjohnwu/magisk/ui/flash/FlashScreen.kt @@ -87,7 +87,7 @@ fun FlashScreen( ) { Icon( imageVector = Icons.AutoMirrored.Filled.ArrowBack, - contentDescription = null, + contentDescription = stringResource(CoreR.string.back), ) } }, diff --git a/app/apk/src/main/java/com/topjohnwu/magisk/ui/home/HomeScreen.kt b/app/apk/src/main/java/com/topjohnwu/magisk/ui/home/HomeScreen.kt index e4d5e0e23..024fe4b30 100644 --- a/app/apk/src/main/java/com/topjohnwu/magisk/ui/home/HomeScreen.kt +++ b/app/apk/src/main/java/com/topjohnwu/magisk/ui/home/HomeScreen.kt @@ -65,6 +65,9 @@ import androidx.compose.ui.input.nestedscroll.nestedScroll import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource +import androidx.compose.ui.semantics.semantics +import androidx.compose.ui.semantics.toggleableState +import androidx.compose.ui.state.ToggleableState import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.unit.DpOffset import androidx.compose.ui.unit.dp @@ -332,6 +335,10 @@ private fun RebootButton( ) } DropdownMenuItem( + // The check mark is the only sign of the safe mode state, so expose it + modifier = if (isSafeMode) { + Modifier.semantics { toggleableState = ToggleableState(safeModeEnabled >= 2) } + } else Modifier, text = { Text( text = stringResource(item.labelRes), diff --git a/app/apk/src/main/java/com/topjohnwu/magisk/ui/module/ActionScreen.kt b/app/apk/src/main/java/com/topjohnwu/magisk/ui/module/ActionScreen.kt index 2b4c2e9cd..78abcf587 100644 --- a/app/apk/src/main/java/com/topjohnwu/magisk/ui/module/ActionScreen.kt +++ b/app/apk/src/main/java/com/topjohnwu/magisk/ui/module/ActionScreen.kt @@ -82,7 +82,7 @@ fun ActionScreen( ) { Icon( imageVector = Icons.AutoMirrored.Filled.ArrowBack, - contentDescription = null, + contentDescription = stringResource(CoreR.string.back), ) } }, diff --git a/app/apk/src/main/java/com/topjohnwu/magisk/ui/module/ModuleScreen.kt b/app/apk/src/main/java/com/topjohnwu/magisk/ui/module/ModuleScreen.kt index db74ff79c..962bc5ece 100644 --- a/app/apk/src/main/java/com/topjohnwu/magisk/ui/module/ModuleScreen.kt +++ b/app/apk/src/main/java/com/topjohnwu/magisk/ui/module/ModuleScreen.kt @@ -66,6 +66,8 @@ import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.platform.LocalResources import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.stringResource +import androidx.compose.ui.semantics.contentDescription +import androidx.compose.ui.semantics.semantics import androidx.compose.ui.text.font.FontWeight import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.text.style.TextDecoration @@ -327,7 +329,9 @@ private fun ModuleCard( } Switch( checked = item.isEnabled, - onCheckedChange = { viewModel.toggleEnabled(item) } + onCheckedChange = { viewModel.toggleEnabled(item) }, + // The switch is its own node, so name the module it enables + modifier = Modifier.semantics { contentDescription = item.module.name }, ) } @@ -389,7 +393,7 @@ private fun ModuleCard( Icon( modifier = Modifier.size(18.dp), imageVector = Icons.Default.PlayArrow, - contentDescription = stringResource(CoreR.string.module_action) + contentDescription = null ) Text( text = stringResource(CoreR.string.module_action), @@ -424,7 +428,7 @@ private fun ModuleCard( Icon( modifier = Modifier.size(18.dp), imageVector = Icons.Default.CloudUpload, - contentDescription = stringResource(CoreR.string.update), + contentDescription = null, ) Text( text = stringResource(CoreR.string.update),