简体   繁体   English

在 Aggrid 中使用 ARC 工具包的可访问性问题

[英]Accessibility issue using ARC Toolkit in Aggrid

We are using Arc Toolkit for running our WCAG compliance check and we are seeing an issue in this grid我们正在使用Arc Toolkit运行我们的 WCAG 合规性检查,我们在这个网格中看到了一个问题

Issue 1: Non-active element in tab order问题 1:Tab 顺序中的非活动元素

Description The element has been placed in the Tab order using tabindex="0", but it lacks a specific role="..." attribute.描述The element has been placed in the Tab order using tabindex="0", but it lacks a specific role="..." attribute.

The Automated testing tools will identify this as an issue when using the tabindex=0 on elements that present no role or 'generic' role as divs or spans.当在没有角色或“通用”角色作为 div 或 span 的元素上使用tabindex=0时,自动化测试工具会将其识别为问题。 This is not recommended from an accessibility perspective, there are several reasons for avoiding that.从可访问性的角度来看,不建议这样做,有几个原因可以避免这种情况。 Some of them are:他们之中有一些是:

  • When the Screen Reader user moves the focus to this kind of element, they will expect that action is triggered.当屏幕阅读器用户将焦点移至此类元素时,他们会期望触发该操作。
  • The number of Tab key pressing might be too much for keyboard users with motor disabilities.对于有运动障碍的键盘用户来说,按 Tab 键的次数可能太多了。

https://www.a11yproject.com/posts/how-to-use-the-tabindex-attribute/#making-non-interactive-elements-focusable https://www.a11yproject.com/posts/how-to-use-the-tabindex-attribute/#making-non-interactive-elements-focusable

The main point is to try to avoid this as much as possible, so, you could ask yourself, is that tabindex=0 really needed?重点是尽量避免这种情况,所以,你可以问自己, tabindex=0真的需要吗? If the focus needs to be placed programmatically in error messages or headings, you should use a tabindex =-1 instead.如果需要以编程方式将焦点放在错误消息或标题中,则应改用tabindex =-1

Hope this helps on your a11y journey.希望这对您的 a11y 之旅有所帮助。

Generally this is a good error message but in this specific case the grid is doing some javascript magic and is trapping keyboard events and handling the tabbing directly instead of allowing the browser to do it.通常这是一个很好的错误消息,但在这种特定情况下,网格正在执行一些 javascript 魔术,并且正在捕获键盘事件并直接处理选项卡而不是允许浏览器执行此操作。 So you can't actually tab to either of the two <div> elements it's complaining about:所以你实际上不能选择它抱怨的两个<div>元素中的任何一个:

<div class="ag-tab-guard ag-tab-guard-top" role="presentation" tabindex="0"></div>
...
<div class="ag-tab-guard ag-tab-guard-bottom" role="presentation" tabindex="0"></div>

The scanning tool doesn't know anything about the javascript behind the scenes so it doesn't know this and will flag it as an issue.扫描工具对幕后的 javascript 一无所知,因此它不知道这一点并将其标记为问题。

You can see this a little more clearly on the grid column headers, which are keyboard focusable and have a role="columnheader" but they also have tabindex="-1" , meaning you should not be able to tab to them directly but can move the focus to them programmatically (from javascript).您可以在网格列标题上更清楚地看到这一点,这些标题可通过键盘聚焦并具有role="columnheader"但它们也有tabindex="-1" ,这意味着您应该直接使用tab键,但可以以编程方式将焦点移到它们身上(来自 javascript)。

<div role="columnheader" tabindex="-1" aria-sort="none" aria-description="Press ENTER to sort. Press CTRL ENTER to open column menu." aria-colindex="4">

So the only way the column headers can receive focus is if the javascript is trapping on the tab event and programmatically moving the focus there.因此,列标题可以接收焦点的唯一方法是 javascript 是否捕获选项卡事件并以编程方式将焦点移到那里。

If you're trying to have a clean ARC scan, unless you can modify the grid code or are allowed to customize your ARC scan to filter out these two elements, you'll have to live with this error that isn't really an error.如果您尝试进行干净的 ARC 扫描,除非您可以修改网格代码或允许自定义 ARC 扫描以过滤掉这两个元素,否则您将不得不忍受这个实际上并不是错误的错误.

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

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