Status Update
Comments
si...@gmail.com <si...@gmail.com> #2
Hi. Thanks for reporting this. Fixed in alpha-04
aa...@yandex-team.ru <aa...@yandex-team.ru> #3
Branch: androidx-main
commit e782987543a9f8ccd485e970ddc74564b24378db
Author: Vighnesh Raut <vighnesh.raut13@gmail.com>
Date: Mon Jan 02 15:27:40 2023
fix: tab row crashes when only 1 tab is added
Bug:
Test: Added unit test
Change-Id: I6381dbac304fc1d69d3708c6655f8b595668e93f
M tv/tv-material/src/androidTest/java/androidx/tv/material/TabRowTest.kt
M tv/tv-material/src/main/java/androidx/tv/material/TabRow.kt
si...@gmail.com <si...@gmail.com> #4
si...@gmail.com <si...@gmail.com> #5
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.tv:tv-material:1.0.0-alpha04
si...@gmail.com <si...@gmail.com> #6
Also there's new code:
@OptIn(ExperimentalMaterialApi::class)
@Composable
fun MyScreen2() {
Box {
var value by remember { mutableStateOf(Value.None) }
LazyColumn(Modifier.background(Color(0xFFEEEEEE))) {
item {
Spacer(
Modifier
.height(200.dp)
.fillMaxWidth()
)
}
items(50) {
ListItem(
Modifier
.fillMaxWidth()
.then(if (it == 0) Modifier.height(100.dp) else Modifier)
.clickable { }) {
Text("Item #${it + 1}")
}
}
}
Box(
modifier = Modifier
.fillMaxWidth()
.height(120.dp)
.background(MaterialTheme.colors.surface.copy(alpha = 0.9f))
.then(when (value) {
Value.None -> Modifier
Value.TestTag -> Modifier.testTag("tag")
Value.TraversalGroup -> Modifier.semantics { isTraversalGroup = true }
})
) {
Text("Screen title: 1.6.0-beta01", Modifier.align(Alignment.Center), fontWeight = FontWeight.Bold)
}
Column(
modifier = Modifier
.align(Alignment.BottomEnd)
.selectableGroup()
.background(Color.Black.copy(0.1f))
.padding(16.dp)
) {
Spacer(Modifier.height(4.dp))
for (enum in Value.entries) {
Row(
horizontalArrangement = Arrangement.Center,
verticalAlignment = Alignment.CenterVertically,
modifier = Modifier
.sizeIn(48.dp, 48.dp)
.clickable { value = enum }
) {
RadioButton(
selected = value == enum,
onClick = null,
)
Text(
when (enum) {
Value.None -> "None"
Value.TestTag -> "TestTag"
Value.TraversalGroup -> "TraversalGroup"
}
)
}
}
}
}
}
ae...@google.com <ae...@google.com> #7
Thanks for the update and for filing the bug originally. Indeed testTag
.
The full list of built-in properties that do not cause pruning is those that are defined as plain SemanticsPropertyKey
instead of AccessibilityKey
in testTag
, testTagsAsResourceId
, invisibleToUser
, textSubstitution
, isShowingTextSubstitution
, indexForKey
and editable
.
Re: traversalGroup
, making it continue to cause prune is by design.
- First on the general principle that it is an accessibility-related property and all of the others cause pruning too.
- Also because
traversalGroup
is the only semantics property on non-clickable Material Surfaces. And as described in point 3 of , these are designed to block touch input, and if elements underneath them cannot be reached by touch, then for consistency they should not be reachable by TalkBack linear traversal either.aosp/1660323
Re: traversalIndex
there is more flexibility: the only rationale for that one was the general principle but I'm guessing it would probably not break any behavior to switch it to a plain SemanticsPropertyKey
.
Anyway, either way to consider a further change, I would like to hear more about the real-life use case motivating the question. What is the scenario where you must use traversalGroup
to solve one problem but at the same the pruning causes an different problem? (And I would be more likely to consider a change in Compose if I'm convinced there's no reasonable workaround on the app side.)
aa...@yandex-team.ru <aa...@yandex-team.ru> #8
I tried on
As for Material Surface, if the change for IsTraversalGroup and TraversalIndex is to be implemented, you can add another semantics property to it, that will cause pruning. Perhaps IsContainer is a good candidate for such semantics property, it will work the same as IsTraversalGroup, but will also prune.
Here two videos: TraversalFalse demonstrates, that no pruning occurs, but traversal order is broken; and TraversalTrue demonstrates, that traversal order is good, but unwanted pruning occurs.
ap...@google.com <ap...@google.com> #9
Branch: androidx-main
commit c143a80f296dec3193417b9f839dfbb63896a753
Author: Alexandre Elias <aelias@google.com>
Date: Thu Nov 23 02:34:19 2023
A11y importance, visibility and pruning improvements
1. Make isTraversalGroup and traversalIndex no longer be marked
AccessibilityKey (that is, no longer be important nor prune nodes
under them, if they are the only semantics on a node).
2. Make hittesting and pruning algorithm consistent with each other: now
they both skip over unimportant and invisible nodes (previously,
hittesting only skipped invisible and pruning only skipped
unimportant).
- Likewise improve consistency by making screenReaderFocusable
take visibility into account (although it still retains a
distinct concept of "speaking" as a substitute for importance).
Also includes the following API additions, which help implement the
above without breaking any behavior:
- New property isOpaque, so that nonclickable Material Surfaces can
continue to prune even if they have no other semantics than
isContainer on them.
- New experimental SemanticsPropertyReceiver.unset to remove individual
properties, which is needed for 'isContainer = false' to avoid the
side effect of pruning, and is an overdue feature that should help
avoid overuse of clearAndSetSemantics.
Bug: 317966058
Bug: 246056649
Test: 7 new tests
Relnote: "New semantics API unset() to remove semantics properties that
are added in the same modifier chain. New semantics property isOpaque."
Change-Id: I8c583e571956d1501f4df7312a4c60edae0a1bc0
M compose/ui/ui/api/current.txt
M compose/ui/ui/api/restricted_current.txt
M compose/ui/ui/src/androidInstrumentedTest/kotlin/androidx/compose/ui/AndroidAccessibilityTest.kt
M compose/ui/ui/src/androidInstrumentedTest/kotlin/androidx/compose/ui/semantics/SemanticsTests.kt
M compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/platform/AndroidComposeViewAccessibilityDelegateCompat.android.kt
M compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/platform/SemanticsUtils.android.kt
M compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/semantics/SemanticsConfiguration.kt
M compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/semantics/SemanticsProperties.kt
ae...@google.com <ae...@google.com> #10
testTag
no longer causes pruning in Compose 1.6, and traversalGroup/traversalIndex
will no longer cause pruning in Compose 1.7 (due this summer).
so...@google.com <so...@google.com>
ap...@google.com <ap...@google.com> #11
Branch: androidx-main
commit 55fb1224271bff2cda62b0fed18d8e95e667014f
Author: Melba Nuzen <mnuzen@google.com>
Date: Tue Jun 11 11:35:38 2024
Mark `isTraversalGroup` and `traversalIndex` as SemanticsPropertyKey
`isTraversalGroup` and `traversalIndex` are now SemanticsPropertyKeys instead of AccessibilityKey. This means they are no longer marked as important for a11y nor prune nodes under them, if they are the only semantics on a node.
Prior to this CL, `isContainer`'s underlying implementation called on `isTraversalGroup`. Changing `isTraversalGroup` changes `isContainer`'s too. To maintain the existing behavior of non-clickable Material surfaces that use `isContainer`, `isContainer` no longer uses `isTraversalGroup` for underlying implementation and is instead an AccessibilityKey.
Test: testSortedAccessibilityNodeInfo_traversalGroupClipping, isContainerProperty_unmergedConfig, and others. Also verified manually that TalkBack no longer clips inside lazy list.
Bug: 246056649
Bug: 335726351
Change-Id: I94ca844ced750c40bd9d0c4f0b17b1c40cf4dfe0
M compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/DatePicker.kt
M compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Surface.kt
M compose/ui/ui/src/androidInstrumentedTest/kotlin/androidx/compose/ui/AndroidAccessibilityTest.kt
M compose/ui/ui/src/androidInstrumentedTest/kotlin/androidx/compose/ui/semantics/SemanticsTests.kt
M compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/semantics/SemanticsProperties.kt
mn...@google.com <mn...@google.com> #12
isTraversalGroup/traversalIndex
no longer prune again with a
Description
Jetpack Compose version: 1.3.0-beta01
Adding
Modifier.testTag()
to some element causes it to clip accessibility nodes underneath such element and making these nodes undiscoverable by accessibility service.In the attached video you can see, that when
testTag()
is not applied, everything works as expected - Item#1 isn't clipped, and navigation works correctly - when navigating from Item#16 forward, LazyColumn scrolls down one screen height and Item#17 becomes selected, then when navigating backwards LazyColumn scrolls up and Item#16 becomes selected. But whentestTag()
is applied to "top bar", Item#1 starts to clip, and also navigation breaks - when navigating from Item#16 forward, LazyColumn scrolls and Item#33 becomes selected (because Item#17 becomes clipped), and other way is the same - when navigating from Item#19 backwards, Item#2 becomes selected.