[英]how to make this javascript application accessible?
Im making an FTP client, which will rely a lot on javascript.我正在制作一个 FTP 客户端,它将在很大程度上依赖于 javascript。
When browsing through the files, you can navigate using the arrow keys.浏览文件时,您可以使用箭头键进行导航。 I add a class of.selected to the currently selected filename, but how can I make this clear to screenreaders?我将 class of.selected 添加到当前选定的文件名中,但是如何让屏幕阅读器清楚这一点? How do I make them focus on the current filename?如何让他们专注于当前文件名?
Would the best way be to make every filename an anchor, which will get the focus when the filename is selected? Would the best way be to make every filename an anchor, which will get the focus when the filename is selected? And also, where can I find a good guide on web application accessibility?而且,我在哪里可以找到关于 web 应用程序可访问性的良好指南? I know the W3C has a checklist for content accessibility, but most of the points there don't apply to web apps.我知道 W3C 有一个内容可访问性清单,但其中的大部分内容不适用于 web 应用程序。
Simplest way to do this is perhaps to have a series of checkboxes, each with a unique ID, paired with a label:最简单的方法可能是使用一系列复选框,每个复选框都有一个唯一的 ID,并与 label 配对:
<input id="chk01" type="checkbox"/><label for="chk01">File1.txt</label>
Using this technique, the input is doing the work of exposing a selected-ness for you, while the label takes care of associating it with the name: when focus goes to the checkbox, the screenreader will automatically read out the associated label text.使用这种技术,输入会为您显示选定内容,而 label 负责将其与名称相关联:当焦点转到复选框时,屏幕阅读器将自动读出相关的 label 文本。 It's all plain HTML, nothing special required.都是普通的 HTML,没有什么特别要求。 You're free of course to add in selection coloring on top of this - so long as you keep it in sync with checkbox state.您当然可以在此之上添加选择颜色 - 只要您将其与复选框 state 保持同步。
It may be possible to do something similar with A tags;可以用 A 标签做类似的事情; you can use WAI-ARIA properties to set role="listitem" and aria-selected="true"/"false" as appropriate on the items, with role="list" on the parent container.您可以使用WAI-ARIA属性在项目上适当设置 role="listitem" 和 aria-selected="true"/"false",在父容器上设置 role="list"。 A screenreader will then read these out as list items, rather than links.然后,屏幕阅读器会将这些内容作为列表项而不是链接读出。 This technique is more involved, however, and would really need to be tested with an actual screen reader (eg JAWS, or the freely-available NVDA) to ensure it works.然而,这种技术涉及更多,并且确实需要使用实际的屏幕阅读器(例如 JAWS 或免费提供的 NVDA)进行测试,以确保其正常工作。
I would suggest you use a javascript framework to help with accessibility in conjunction with WAI-ARIA For examples of accessible jQuery see https://github.com/fnagel/jQuery-Accessible-RIA/wiki and for examples of accessible drag and drop with WAI-ARIA see http://dev.opera.com/articles/view/accessible-drag-and-drop/我建议您使用 javascript 框架来帮助与WAI-ARIA结合使用可访问性有关可访问性 jQuery 的示例,请参阅https://github.com/fnagel/可访问性和可访问性拖放示例WAI-ARIA 见http://dev.opera.com/articles/view/accessible-drag-and-drop/
First - make sure your basics are covered.首先 - 确保您的基础知识已涵盖。 The Web Content Accessibility Guidelines (WCAG) don't cover interactivity well, but many of its points remain applicable to web applications. Web 内容可访问性指南 (WCAG) 没有很好地涵盖交互性,但它的许多要点仍然适用于 web 应用程序。
Next - learn about the ARIA standard for Accessible Rich Internet Applications.下一步 - 了解可访问富 Internet 应用程序的 ARIA 标准。 This will cover a lot of the interactivity you're trying for.这将涵盖您正在尝试的许多交互性。
Some relevant links:一些相关链接:
There are a number of books on accessibility, which tend to get outdated fairly fast.有许多关于可访问性的书籍,它们往往很快就会过时。 Sadly, I'm not aware of any book-length discussions of ARIA -- it's still in development.可悲的是,我不知道有任何关于 ARIA 的书籍长度的讨论——它仍在开发中。 Try reading the specs.尝试阅读规格。
Last but not least -- get a screen reader and learn to use it.最后但并非最不重要的 - 获取屏幕阅读器并学习使用它。 Formal compliance with accessibility standards is great, but nothing beats real testing.对可访问性标准的正式合规性很好,但没有什么比真正的测试更好的了。 NVDA is a free and fully featured screen reader that has decent support for ARIA: http://nvda-project.org/ NVDA 是一款免费且功能齐全的屏幕阅读器,对 ARIA 提供了不错的支持: http://nvda-project.org/
Hope this helps.希望这可以帮助。
When browsing through the files, you can navigate using the arrow keys.浏览文件时,您可以使用箭头键进行导航。
Building upon a previous answer that neglected this feature, wrap the entire widget in a div with role=application.建立在忽略此功能的先前答案的基础上,将整个小部件包装在一个 div 中,其中角色=应用程序。 This notifies the screen reader that JavaScript will be used and will allow the user to navigate the widget with the arrow keys while using a screen reader.这会通知屏幕阅读器 JavaScript 将被使用,并允许用户在使用屏幕阅读器时使用箭头键导航小部件。 The excerpt below details how to design the widget to be accessible.下面的摘录详细介绍了如何设计可访问的小部件。 Yes, it's not the simplest solution, but it is the most complete.是的,这不是最简单的解决方案,但它是最完整的。 Take your pick.任你选。
Description: A widget that allows the user to select one or more items from a list of choices. 描述:一个允许用户从选择列表中选择一个或多个项目的小部件。 (listbox
).
( listbox
)。
Keyboard Interaction:
键盘交互:
listbox
. listbox 容器的作用是listbox
。option
and should be DOM children of listbox
.列表框中的每个条目都应该有一个角色option
,并且应该是listbox
的 DOM 子项。aria-owns
.如果不是列表框的 DOM 子项,则它应该由aria-owns
在列表框中引用。aria-setsize
and aria-posinset
accordingly;如果列表框中的所有项目都不是列表框的 DOM 子项,则相应地设置它们的aria-setsize
和aria-posinset
; otherwise, this information cannot be computed for context by the user agent.否则,用户代理无法为上下文计算此信息。aria-label
referenced on the listbox by aria-labelledby
.如果列表框不是另一个小部件的一部分,那么它应该有一个可见的aria-label
由aria-labelledby
在列表框上引用。aria-selected
="true".每个选定的列表项都应具有aria-selected
="true"。Examples:例子:
Single select listbox单 select 列表框
Listbox in an iframe iframe 中的列表框
Refer to the authoring practices for accessible widgets for examples and more information.有关示例和更多信息,请参阅可访问小部件的创作实践。
From what I understand, YUI has a large amount of support for ARIA.据我了解,YUI 对 ARIA 有很大的支持。
See:看:
http://developer.yahoo.com/yui/theater/video.php?v=kloots-yuiconf2009-a11y http://developer.yahoo.com/yui/theater/video.php?v=kloots-yuiconf2009-a11y
Make sure your solution conforms to ARIA:确保您的解决方案符合 ARIA:
http://www.w3.org/WAI/intro/aria.php http://www.w3.org/WAI/intro/aria.php
HTH HTH
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.