Status Update
Comments
ma...@google.com <ma...@google.com>
je...@google.com <je...@google.com> #2
je...@google.com <je...@google.com> #3
Since this hasn't been implemented yet, please consider the case where the user needs to access the FAB (or other component) while they're in the middle of an infinitely scrolling list (like a Twitter feed) when adding support.
The traversal methods had limited usefulness (but agreed with Fanny, they were useful :+1:) since they would only work at the start of a user journey. If the user wants to navigate from a list item to a FAB or an action item in the app bar and back, then it's less useful.
me...@thomaskeller.biz <me...@thomaskeller.biz> #4
Yinglei, yes, I had an impression that we don't want to expose this API. Can we solve the issue with FAB without it?
As for the z-order, we currently order them as far as I remember. So whichever element is on top it will be focused first, correct?
fanny.pluvinage@ Do you have a particular use case in mind where you need to re-order elements for accessibility in z-direction?
je...@google.com <je...@google.com> #5
I understand why you don't want to expose this API.
Maybe i've done something wrong, but when adding a FAB Button after a LazyColumn, the LazyColumn get the focus first even if I change the zIndex modifier = Modifier.zIndex(0f)
(setting the FAB Button on top or behind, it seems that it doesn't change anything.
FloatingActionButton(onClick = { /*TODO*/ },
modifier = Modifier.zIndex(0f)) {
Icon(painter = painterResource(id = R.drawable.ic_star_rate),
contentDescription = "Add movie")
}
LazyColumn(modifier = Modifier.zIndex(1f)) {
items(viewModel.movies) { message ->
MovieItem(message, backgroundColors.random())
}
}
I had a similar usecase to design a card like visual element earlier this year when I was doing SwiftUI. I was able to resolve it with .accessibility(sortPriority: 2)
I'll try to send you a screenshot later, when Xcode will have finish building ...
me...@thomaskeller.biz <me...@thomaskeller.biz> #6
For
For #4, currently, I think elements on top will be focused last (if it is not completely covering the node below it). Maybe we should consider changing it (don't break the finding node for touch explore though)?
je...@google.com <je...@google.com> #8
me...@thomaskeller.biz <me...@thomaskeller.biz> #9
headings, another mode could allow navigation between fixed components on
screen like the app bar and fab (as an idea).
Since it hasn't been exposed in the compose API yet, I wanted to highlight
this limitation of the existing traversal APIs; most of the accessibility
APIs were added before I was an Android dev so this is a unique chance for
feedback ☺️
On Tue, 27 Apr 2021, 20:24 , <buganizer-system@google.com> wrote:
je...@google.com <je...@google.com> #10
screen like the app bar and fab " seems to be a feature which should implemented in talkback.
@Anastasia @Alex
Maybe when we order nodes, if two nodes partially overlap, we should consider z index first(top one first)? instead of relying on bounds (the current approach adopted from ViewGroup.java)?
ap...@google.com <ap...@google.com> #11
Yes, disambiguating based on zIndex
sounds like a good idea, I can't think of any reason not to do it that way. It looks like the reason ViewGroup didn't have it is simply because View System didn't have zIndex
(it supported translationZ
, but structurally zIndex
is better suited to calculate overlap order without requiring any matrix math).
je...@google.com <je...@google.com>
me...@thomaskeller.biz <me...@thomaskeller.biz> #12
I agree with Yinglei that if TalkBack's auto-scrolling is preventing access to a FAB, that bug is likely best addressed in TalkBack, perhaps with a heuristic that everything on the screen should be traversed before a list that will auto-scroll. If ordering nodes based on z helps in the meantime, though, that seems like a reasonable change to make.
Since system-level FABs are in their own windows, maybe app-level FABs should be in their own panes? That seems semantically correct, and TalkBack does announce panes when they appear. Not sure if/how this concept is exposed in Compose, though.
me...@thomaskeller.biz <me...@thomaskeller.biz> #13
Here is the API that I think is doing that in SwiftUI
The developer could add a sortPriority to a composable and if we detect that it will influence the Semantic sort : you can first order by sortPriority then by ordering left-to-right, top-to-bottom.
(sorry for the intrusion but although the solution "consider z index first(top one first)?" is a working fix, I don't think it provide the best user experience and will probably be tricky to handle with the auto-scroll).
je...@google.com <je...@google.com> #14
I tried the "when we order nodes, if two nodes partially overlap, we should consider z index first(top one first)" approach. It does work if we have z-index defined, but by default, floating action button doesn't have a higher z index, as I can see from
demo app -> material-> scaffold -> scaffold with snackbar
both the scrollable node and fab have z-index 0.0, so by default (if we don't set a higher z-index for fab), it won't solve the problem (if we set z-index to 5.0, fab will be focused first).
Also, I'm not sure whether this z-index sorting approach is reliable because the sorting is done on layout node level instead of semantics tree, for example, if we have one layoutnode with two children: 1. scrollable layout node for lazy list, 2. a layout node(call it A) which is a parent of the fab. If we set the z-index of the fab only, we don't affect layout node A, and won't affect the sorting.
Now we have a problem: I'm not sure talkback has the plan to change auto scroll. In view system, we have this traverse order api(even though we don't like it, and I believe android message app has the same infinite scroll and not reach fab issue and they didn't fix it using the traverse order api), but in compose, we don't have anything. Maybe is a solution to add ordering api?
me...@thomaskeller.biz <me...@thomaskeller.biz> #15
me...@thomaskeller.biz <me...@thomaskeller.biz> #16
"allow navigation between fixed components on screen like the app bar and fab " seems to be a feature which should implemented in talkback.
Agree.
I think it's important to distinguish between properly describing the UI and correct TalkBack behavior.
Agree.
My suggestion was that it should be possible to describe the nature of components like FABs and other app chrome like appbars by being able to mark them as chrome, similar to how it's possible to mark arbitrary views as headings. This needs to be implemented in compose and/or the view system since this is what the app developer has access to.
It adds metadata about these components that accessibility services can then use (which is separate). TalkBack could add it as a navigation type like headings, paragraphs, words etc. which allows the user to jump between layers. TalkBack could use it in the autoscroll case that Phill mentioned too (iterate through app chrome before autoscroll - though it does sound annoying, maybe it could be an opt-out setting). Switch access could incorporate it too, since it has the same issue.
me...@thomaskeller.biz <me...@thomaskeller.biz> #17
Headings allow this somewhat, but only if there are no headings in the list.
Panes also allow jumping out of the list, with more flexibility, now that we have next-window actions.
The best option seems to be generalized containers with enter/exit actions & gestures.
> components like FABs and other app chrome like appbars by being able to mark them as chrome,
I like this idea, because it provides high-level information that gives talkback flexibility to apply various navigation policies. But it does not necessarily solve the infinite-list problems since chrome may not exist before/after the list.
> order by sortPriority then by ordering left-to-right, top-to-bottom.
This sounds functionally equivalent to traverse-before/after, though somewhat easier to use.
ap...@google.com <ap...@google.com> #18
Hey, so we are working on App Widgets, and one of the layout we are working with is this:
There are five locations for buttons, and iterating through them should probably be from more important to less important, meaning the center first, and then around in a circle, starting probably from top-left, although this might depend on whether the UI is LTR or RTL and on the exact application.
Description
Previously with plain XML UIs, one was able to test ViewModel and UI (Fragment/Activity + XML) in combination. With Compose and the
AndroidComposeTestRule
this is no longer possible:AndroidComposeTestRule
needs a test rule that provides anActivity
to the underlying compose infrastructure, while one can give it aFragmentScenarioRule
the fragment part of this cannot actually be re-used and the content of the whole Activity is replaced by the Compose UI.ComposeView.setContent()
of theFragment
(orActivity
, for that matter) isn't run when theAndroidComposeTestRule
'ssetContent
is used instead. Even worse, depending on the lifecycle state in which anActivity
is in (in which state it is started), a previous rendering could or could not have happened, leading to possible side effects with an actualViewModel
interfacing implementation.ComposeView
is not the root view of the controller component.I understand that a special
Recomposer
setup and a lot of other custom tooling is needed to make Jetpack Compose testable in an Robolectric / Android Instrumentation test, however I wish the test architecture would first and foremost provide an API to hook in / replace the existing functionality, e.g. by making it easy to inject a custom test composer in a running fragment / activity instance or by at least making this composer and possibly other utilities available for certain testing purposes.