2
0
mirror of https://github.com/fork-maintainers/iceraven-browser synced 2024-11-17 15:26:23 +00:00

[fenix] For https://github.com/mozilla-mobile/fenix/issues/24544 - Have Talkback use "expand" and "collapse" actions for collections

This commit is contained in:
Mugurell 2022-09-30 16:56:24 +03:00 committed by mergify[bot]
parent a2158c20fd
commit 41efc4d36c
2 changed files with 16 additions and 2 deletions

View File

@ -35,6 +35,7 @@ import mozilla.components.browser.state.state.recover.RecoverableTab
import mozilla.components.concept.engine.Engine
import mozilla.components.feature.tab.collections.Tab
import mozilla.components.feature.tab.collections.TabCollection
import org.mozilla.fenix.R
import org.mozilla.fenix.R.drawable
import org.mozilla.fenix.R.string
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.
*/
@Composable
@Suppress("LongParameterList")
@Suppress("LongParameterList", "LongMethod")
fun Collection(
collection: TabCollection,
expanded: Boolean,
@ -79,7 +80,14 @@ fun Collection(
Card(
modifier = Modifier
.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),
shape = if (isExpanded) expandedCollectionShape else collapsedCollectionShape,
backgroundColor = FirefoxTheme.colors.layer2,

View File

@ -1870,4 +1870,10 @@
<!-- Snackbar button text to navigate to telemetry settings.-->
<string name="experiments_snackbar_button">Go to settings</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>