Fixed
Status Update
Comments
yi...@google.com <yi...@google.com> #2
For recyclerview, if developers don't explicitly report how many items are there (and set collectionItemInfo), we don't report how many items are there. So I think maybe we should do the same in compose.
so...@google.com <so...@google.com> #3
Yeah, that makes sense. The only thing is that we can't tell if node is lazy or not, so this change require additional API anyway.
cl...@google.com <cl...@google.com> #4
P0 means don't go home until it is fixed, are you sure that's what you meant Amanda?
ma...@google.com <ma...@google.com> #5
Could you please clarify why do you need Unknown
as a default in the CollectionInfo? Is there a reason to NOT to enforce this information from developers to specify this explicitly? It seems like it could be a requires parameter and we could remove "Unknown" enum value, increasing the understandability of the API surface.
If Unknown
has a special meaning in the a11y services (like "default"), maybe you could name is as "Auto".
ma...@google.com <ma...@google.com> #6
Copy paste from
yi...@google.com <yi...@google.com> #7
The default in native android is
/** Selection mode where items are not selectable. */
public static final int SELECTION_MODE_NONE = 0;
CollectionItemInfo in android has a parameter called selected (view.java also has a selected property, and is translated to AccessibilityNodeInfo.selected). In Compose, we also have a selected property, which is used for radio button and tab (in native android, radio button uses checked property, and tab uses selected property). And I believe in talkback/switch access, CollectionItemInfo.selected is never used.
As you can see, there seems to be a chaos here for selected/checked/toggleable/collectionItemInfo.selected. In compose, we plan not to add the collectionItemInfo.selected property and use semantics selected instead. What if a developer sets selection mode to be none (default) and also set selected property in the items?
/** Selection mode where items are not selectable. */
public static final int SELECTION_MODE_NONE = 0;
CollectionItemInfo in android has a parameter called selected (view.java also has a selected property, and is translated to AccessibilityNodeInfo.selected). In Compose, we also have a selected property, which is used for radio button and tab (in native android, radio button uses checked property, and tab uses selected property). And I believe in talkback/switch access, CollectionItemInfo.selected is never used.
As you can see, there seems to be a chaos here for selected/checked/toggleable/collectionItemInfo.selected. In compose, we plan not to add the collectionItemInfo.selected property and use semantics selected instead. What if a developer sets selection mode to be none (default) and also set selected property in the items?
ap...@google.com <ap...@google.com> #8
Project: platform/frameworks/support
Branch: androidx-main
commit 8dddaeb8d6af1e2c6ae4518376132d8c00d3cf97
Author: Anastasia Soboleva <soboleva@google.com>
Date: Wed Apr 07 16:17:46 2021
Add Collection(Item)Info semantics API
Any lazy list by default will report "-1" as the number of elements because we can't calculate correctly the number of elements that should be reported for a11y.
When `Modifier.selectableGroup()` is used with lazy lists, we won't report anymore only visible elements on the screen.
Test: new tests, manually with Talkback on
Bug: 180479017
Relnote: "Added CollectionInfo and CollectionItemInfo accessibility APIs that allows to mark collection and its items for accessibility services"
Change-Id: Id54ef37379e14e41ac52782b40e29de54f95eed0
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/LazyList.kt
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/selection/SelectableGroup.kt
M compose/material/material/integration-tests/material-demos/src/main/java/androidx/compose/material/demos/BottomNavigationDemo.kt
M compose/material/material/src/commonMain/kotlin/androidx/compose/material/TabRow.kt
M compose/ui/ui/api/1.0.0-beta06.txt
M compose/ui/ui/api/current.txt
M compose/ui/ui/api/public_plus_experimental_1.0.0-beta06.txt
M compose/ui/ui/api/public_plus_experimental_current.txt
M compose/ui/ui/api/restricted_1.0.0-beta06.txt
M compose/ui/ui/api/restricted_current.txt
M compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/AndroidComposeViewAccessibilityDelegateCompatTest.kt
A compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/accessibility/CollectionInfoTest.kt
M compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/platform/AndroidComposeViewAccessibilityDelegateCompat.android.kt
A compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/platform/accessibility/CollectionInfo.kt
M compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/semantics/SemanticsProperties.kt
https://android-review.googlesource.com/1667155
Branch: androidx-main
commit 8dddaeb8d6af1e2c6ae4518376132d8c00d3cf97
Author: Anastasia Soboleva <soboleva@google.com>
Date: Wed Apr 07 16:17:46 2021
Add Collection(Item)Info semantics API
Any lazy list by default will report "-1" as the number of elements because we can't calculate correctly the number of elements that should be reported for a11y.
When `Modifier.selectableGroup()` is used with lazy lists, we won't report anymore only visible elements on the screen.
Test: new tests, manually with Talkback on
Bug: 180479017
Relnote: "Added CollectionInfo and CollectionItemInfo accessibility APIs that allows to mark collection and its items for accessibility services"
Change-Id: Id54ef37379e14e41ac52782b40e29de54f95eed0
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/LazyList.kt
M compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/selection/SelectableGroup.kt
M compose/material/material/integration-tests/material-demos/src/main/java/androidx/compose/material/demos/BottomNavigationDemo.kt
M compose/material/material/src/commonMain/kotlin/androidx/compose/material/TabRow.kt
M compose/ui/ui/api/1.0.0-beta06.txt
M compose/ui/ui/api/current.txt
M compose/ui/ui/api/public_plus_experimental_1.0.0-beta06.txt
M compose/ui/ui/api/public_plus_experimental_current.txt
M compose/ui/ui/api/restricted_1.0.0-beta06.txt
M compose/ui/ui/api/restricted_current.txt
M compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/AndroidComposeViewAccessibilityDelegateCompatTest.kt
A compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/accessibility/CollectionInfoTest.kt
M compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/platform/AndroidComposeViewAccessibilityDelegateCompat.android.kt
A compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/platform/accessibility/CollectionInfo.kt
M compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/semantics/SemanticsProperties.kt
Description
We have a
selectableGroup
modifier for non-lazy lists which iterates through all the 'selectable' nodes to get the indices and number of elements (to setCollectionInfo
andCollectionItemInfo
). Obviously, this does not play well with lazy lists as it only reports the number of visible elements.We need to figure out what it the right approach/API for lazy lists.