mirror of
https://github.com/kvorschk/Magisk.git
synced 2026-12-04 19:10:47 -05:00
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
This commit is contained in:
@@ -183,7 +183,8 @@ fun MainScreen(
|
|||||||
icon = {
|
icon = {
|
||||||
Icon(
|
Icon(
|
||||||
imageVector = ImageVector.vectorResource(tab.iconRes),
|
imageVector = ImageVector.vectorResource(tab.iconRes),
|
||||||
contentDescription = stringResource(tab.titleRes),
|
// The label below already names the tab
|
||||||
|
contentDescription = null,
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
label = { Text(stringResource(tab.titleRes)) },
|
label = { Text(stringResource(tab.titleRes)) },
|
||||||
|
|||||||
@@ -119,7 +119,7 @@ fun DenyListScreen(
|
|||||||
) {
|
) {
|
||||||
Icon(
|
Icon(
|
||||||
imageVector = Icons.AutoMirrored.Filled.ArrowBack,
|
imageVector = Icons.AutoMirrored.Filled.ArrowBack,
|
||||||
contentDescription = null,
|
contentDescription = stringResource(CoreR.string.back),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -219,7 +219,7 @@ private fun SearchInput(
|
|||||||
IconButton(onClick = { onQueryChange("") }) {
|
IconButton(onClick = { onQueryChange("") }) {
|
||||||
Icon(
|
Icon(
|
||||||
imageVector = Icons.Default.Close,
|
imageVector = Icons.Default.Close,
|
||||||
contentDescription = null,
|
contentDescription = stringResource(CoreR.string.close),
|
||||||
tint = MaterialTheme.colorScheme.onSurfaceVariant
|
tint = MaterialTheme.colorScheme.onSurfaceVariant
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ fun FlashScreen(
|
|||||||
) {
|
) {
|
||||||
Icon(
|
Icon(
|
||||||
imageVector = Icons.AutoMirrored.Filled.ArrowBack,
|
imageVector = Icons.AutoMirrored.Filled.ArrowBack,
|
||||||
contentDescription = null,
|
contentDescription = stringResource(CoreR.string.back),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -65,6 +65,9 @@ import androidx.compose.ui.input.nestedscroll.nestedScroll
|
|||||||
import androidx.compose.ui.platform.LocalContext
|
import androidx.compose.ui.platform.LocalContext
|
||||||
import androidx.compose.ui.res.painterResource
|
import androidx.compose.ui.res.painterResource
|
||||||
import androidx.compose.ui.res.stringResource
|
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.text.font.FontWeight
|
||||||
import androidx.compose.ui.unit.DpOffset
|
import androidx.compose.ui.unit.DpOffset
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
@@ -332,6 +335,10 @@ private fun RebootButton(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
DropdownMenuItem(
|
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(
|
Text(
|
||||||
text = stringResource(item.labelRes),
|
text = stringResource(item.labelRes),
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ fun ActionScreen(
|
|||||||
) {
|
) {
|
||||||
Icon(
|
Icon(
|
||||||
imageVector = Icons.AutoMirrored.Filled.ArrowBack,
|
imageVector = Icons.AutoMirrored.Filled.ArrowBack,
|
||||||
contentDescription = null,
|
contentDescription = stringResource(CoreR.string.back),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -66,6 +66,8 @@ import androidx.compose.ui.platform.LocalContext
|
|||||||
import androidx.compose.ui.platform.LocalResources
|
import androidx.compose.ui.platform.LocalResources
|
||||||
import androidx.compose.ui.res.painterResource
|
import androidx.compose.ui.res.painterResource
|
||||||
import androidx.compose.ui.res.stringResource
|
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.font.FontWeight
|
||||||
import androidx.compose.ui.text.style.TextAlign
|
import androidx.compose.ui.text.style.TextAlign
|
||||||
import androidx.compose.ui.text.style.TextDecoration
|
import androidx.compose.ui.text.style.TextDecoration
|
||||||
@@ -327,7 +329,9 @@ private fun ModuleCard(
|
|||||||
}
|
}
|
||||||
Switch(
|
Switch(
|
||||||
checked = item.isEnabled,
|
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(
|
Icon(
|
||||||
modifier = Modifier.size(18.dp),
|
modifier = Modifier.size(18.dp),
|
||||||
imageVector = Icons.Default.PlayArrow,
|
imageVector = Icons.Default.PlayArrow,
|
||||||
contentDescription = stringResource(CoreR.string.module_action)
|
contentDescription = null
|
||||||
)
|
)
|
||||||
Text(
|
Text(
|
||||||
text = stringResource(CoreR.string.module_action),
|
text = stringResource(CoreR.string.module_action),
|
||||||
@@ -424,7 +428,7 @@ private fun ModuleCard(
|
|||||||
Icon(
|
Icon(
|
||||||
modifier = Modifier.size(18.dp),
|
modifier = Modifier.size(18.dp),
|
||||||
imageVector = Icons.Default.CloudUpload,
|
imageVector = Icons.Default.CloudUpload,
|
||||||
contentDescription = stringResource(CoreR.string.update),
|
contentDescription = null,
|
||||||
)
|
)
|
||||||
Text(
|
Text(
|
||||||
text = stringResource(CoreR.string.update),
|
text = stringResource(CoreR.string.update),
|
||||||
|
|||||||
Reference in New Issue
Block a user