For #27128 - Fix accessibility for wallpaper settings "Learn more" heading

This commit is contained in:
Alexandru2909 2022-10-05 16:06:08 +03:00 committed by mergify[bot]
parent 7a240eb9f6
commit 30b8de0dce
2 changed files with 22 additions and 1 deletions

View File

@ -40,7 +40,11 @@ import androidx.compose.ui.graphics.asImageBitmap
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.platform.LocalConfiguration
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.semantics.Role
import androidx.compose.ui.semantics.SemanticsPropertyReceiver
import androidx.compose.ui.semantics.contentDescription
import androidx.compose.ui.semantics.onClick
import androidx.compose.ui.semantics.role
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.text.style.TextDecoration
import androidx.compose.ui.tooling.preview.Preview
@ -126,7 +130,22 @@ private fun WallpaperGroupHeading(
style = FirefoxTheme.typography.subtitle2,
)
} else {
Column {
val label = stringResource(id = R.string.a11y_action_label_wallpaper_collection_learn_more)
val headingSemantics: SemanticsPropertyReceiver.() -> Unit =
if (collection.learnMoreUrl.isNullOrEmpty()) {
{}
} else {
{
role = Role.Button
onClick(label = label) {
onLearnMoreClick(collection.learnMoreUrl, collection.name)
false
}
}
}
Column(
modifier = Modifier.semantics(mergeDescendants = true, properties = headingSemantics),
) {
Text(
text = stringResource(R.string.wallpaper_limited_edition_title),
color = FirefoxTheme.colors.textSecondary,

View File

@ -1880,4 +1880,6 @@
<string name="a11y_action_label_collapse">collapse</string>
<!-- Action label for elements that can be expanded if interacting with them. Talkback will append this to say "Double tap to expand". -->
<string name="a11y_action_label_expand">expand</string>
<!-- Action label for links to a website containing documentation about a wallpaper collection. Talkback will append this to say "Double tap to open link to learn more about this collection". -->
<string name="a11y_action_label_wallpaper_collection_learn_more">open link to learn more about this collection</string>
</resources>