简体   繁体   English

对RecyclerView中的延迟加载子项的RecyclerView可访问性遍历

[英]RecyclerView accessibility traversal for lazy-loaded children in RecyclerView

We can populate a RecyclerView with items and, on binding, we can mark some of those items as 'headings' for accessibility. 我们可以在RecyclerView中填充项目,并在绑定时将其中一些项目标记为可访问性的“标题”。

This means that in the 'headings' traversal mode of TalkBack, the user can navigate directly between them. 也就是说,在“话语提示”的“标题”遍历模式下,用户可以在它们之间直接导航。

However, a RecyclerView obviously binds and unbinds children as it scrolls. 但是, RecyclerView滚动时显然会绑定和取消绑定子级。 At any one time, there may only be a small subset of the total heading items loaded into view holders. 在任何时候,加载到视图持有者中的总标题项目可能只有一小部分。 Traversal between only those items is unhelpful and confusing. 仅在这些项目之间进行遍历是无益且令人困惑的。

Is there a way, or even best practice, to provision the RecyclerView such that we simultaneously satisfy (a) performant view recycling and (b) meaningful traversal for accessibility across the entire set of content? 有没有一种方法甚至最佳实践来提供RecyclerView ,以便我们同时满足(a)高效视图回收和(b)有意义的遍历,以实现对整个内容集的可访问性?

Not all of the items considered headings in your source data set will be visibly present in the RecyclerView at any one time, just those in the current subset of the data presented by the RecycleView.Adapter . 并不是任何时候都可以在RecyclerView中明显看到源数据集中所有被认为是标题的项目,而只是在RecycleView.Adapter提供的数据的当前子集中显示。 Without being visible on screen, accessibility services like TalkBack don't have access to those other headings and therefore will not interact with them. 如果无法在屏幕上看到,像TalkBack这样的可访问性服务将无权访问其他标题,因此将无法与它们交互。

Technically, you could look at setting up custom handling of the accessibility tree , but this would need to handle all accessibility info for the view, not just the headings, and would likely impact performance especially for large data sets. 从技术上讲,您可以考虑设置可访问性树的自定义处理 ,但这将需要处理视图的所有可访问性信息,而不仅仅是标题,并且可能会影响性能,尤其是对于大型数据集。 There is no way to override the heading handling alone. 没有办法单独覆盖标题处理。

The behaviour your describe is default and expected behaviour on Android, even if it doesn't seem ideal from a screen reader user experience perspective. 您描述的行为是Android上的默认行为和预期行为,即使从屏幕阅读器用户体验的角度来看,这似乎并不理想。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM