简体   繁体   English

大型表格的下拉切换器 - 屏幕阅读器用户的可访问性

[英]Dropdown switcher for large tables - accessibility for screen reader users

We've implemented a content switcher using a native dropdown select element, which switches between HTML tables directly underneath.我们使用原生下拉菜单 select 元素实现了一个内容切换器,该元素在 HTML 表之间直接在下面切换。 This is to be used inside blog posts, with various table content relevant to the post.这将在博客文章中使用,具有与文章相关的各种表格内容。 The table will be switched out immediately using JavaScript upon selecting an option from the dropdown.从下拉列表中选择一个选项后,该表将立即使用 JavaScript 切换出去。 Simplified code below for illustration.下面的简化代码用于说明。 We're using React but I don't think that affects the question.我们正在使用 React,但我认为这不会影响问题。

 <div className={styles.csvList}> <label for="csv-table-selector">{label}</label> <Dropdown {...}/> {selectedTable && ( <div id="selected-csv-table" role="region" aria-live="polite"> <h2> {selectedTable.name} <h2> <Table {...}/> </div> )} </div>

Right now we're using a 'polite' aria live region containing the table, which will start to read the whole table out when the table changes.现在我们正在使用一个包含表格的“礼貌” aria live region,当表格发生变化时,它将开始读取整个表格。 This is very similar to the Mozilla Docs implementation example for live regions.这与活动区域的Mozilla Docs 实现示例非常相似。

Is there a limit for the amount of content which is sensible to keep in a live region?在活动区域中保留的内容数量是否有限制? I couldn't find any resources anywhere online with guidance for when content is 'too much'.我无法在网上任何地方找到任何关于内容“过多”时的指导的资源。 With tables, my assumption was that the screen reader user would prefer to navigate them manually rather than have the whole thing read out.对于表格,我的假设是屏幕阅读器用户更愿意手动导航它们而不是读取整个内容。

I also considered having a visually hidden live region, which will read out something like 'Table was updated below' when the table is changed.我还考虑过有一个视觉隐藏的活动区域,当表格更改时,它将读出类似“表格已在下面更新”之类的内容。 Is this more desirable than the whole table being in a live region?这比整个桌子都在一个活动区域中更可取吗?

Is this design doomed to be confusing for screen reader users?这种设计是否注定会让屏幕阅读器用户感到困惑? I'm aware that the 'tabs' design pattern is more usually used for this kind of scenario, so was wondering if we should abandon the dropdown switcher idea and go with that instead.我知道“选项卡”设计模式更常用于这种情况,所以想知道我们是否应该放弃下拉切换器的想法和 go 来代替。

Yes, I would definitely recommend applying the Tabpanel Pattern as this will simplify work for you, and the users.是的,我肯定会推荐应用Tabpanel 模式,因为这将为您和用户简化工作。

Because expectation is simply that when the active tab changes, the immediately following content changed.因为期望只是当活动选项卡发生变化时,紧随其后的内容发生变化。 No additional announcement is necessary.不需要额外的公告。

Solution with Dropdown, Without Live Region带有下拉列表的解决方案,没有实时区域

If you still would like to use the dropdown, the expected behaviour would still be somewhat similar.如果您仍想使用下拉菜单,预期的行为仍会有些相似。

Instead of announcing that content change somewhere on the page, you would guide the user directly to the switched table by setting focus on it.您无需在页面某处宣布内容更改,而是通过设置焦点将用户直接引导至切换表。 Of course the table has an accessible name.当然,该表有一个可访问的名称。

This way you wont ask the user to navigate themselves, after the announcement, but it's already done.这样你就不会在发布后要求用户自己导航,但它已经完成了。

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

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