For #24544 - Have Talkback use "expand" and "collapse" actions for collections

pull/543/head
Mugurell 2 years ago committed by mergify[bot]
parent 0c5b1a910b
commit ddf0dc3b4d

@ -35,6 +35,7 @@ import mozilla.components.browser.state.state.recover.RecoverableTab
import mozilla.components.concept.engine.Engine import mozilla.components.concept.engine.Engine
import mozilla.components.feature.tab.collections.Tab import mozilla.components.feature.tab.collections.Tab
import mozilla.components.feature.tab.collections.TabCollection import mozilla.components.feature.tab.collections.TabCollection
import org.mozilla.fenix.R
import org.mozilla.fenix.R.drawable import org.mozilla.fenix.R.drawable
import org.mozilla.fenix.R.string import org.mozilla.fenix.R.string
import org.mozilla.fenix.compose.list.ExpandableListHeader import org.mozilla.fenix.compose.list.ExpandableListHeader
@ -64,7 +65,7 @@ private val expandedCollectionShape = RoundedCornerShape(topStart = 8.dp, topEnd
* @param onCollectionMenuOpened Invoked when the user clicks to open a menu for the collection. * @param onCollectionMenuOpened Invoked when the user clicks to open a menu for the collection.
*/ */
@Composable @Composable
@Suppress("LongParameterList") @Suppress("LongParameterList", "LongMethod")
fun Collection( fun Collection(
collection: TabCollection, collection: TabCollection,
expanded: Boolean, expanded: Boolean,
@ -79,7 +80,14 @@ fun Collection(
Card( Card(
modifier = Modifier modifier = Modifier
.semantics(mergeDescendants = true) {} .semantics(mergeDescendants = true) {}
.clickable { onToggleCollectionExpanded(collection, !isExpanded) } .clickable(
onClickLabel = if (isExpanded) {
stringResource(R.string.a11y_action_label_collapse)
} else {
stringResource(R.string.a11y_action_label_expand)
},
onClick = { onToggleCollectionExpanded(collection, !isExpanded) },
)
.height(48.dp), .height(48.dp),
shape = if (isExpanded) expandedCollectionShape else collapsedCollectionShape, shape = if (isExpanded) expandedCollectionShape else collapsedCollectionShape,
backgroundColor = FirefoxTheme.colors.layer2, backgroundColor = FirefoxTheme.colors.layer2,

@ -1870,4 +1870,10 @@
<!-- Snackbar button text to navigate to telemetry settings.--> <!-- Snackbar button text to navigate to telemetry settings.-->
<string name="experiments_snackbar_button">Go to settings</string> <string name="experiments_snackbar_button">Go to settings</string>
<string name="firefox_suggest_header">Firefox Suggest</string> <string name="firefox_suggest_header">Firefox Suggest</string>
<!-- Accessibility services actions labels. These will be appended to accessibility actions like "Double tap to.." but not by or applications but by services like Talkback. -->
<!-- Action label for elements that can be collapsed if interacting with them. Talkback will append this to say "Double tap to collapse". -->
<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>
</resources> </resources>

Loading…
Cancel
Save