Skip to main content

无障碍工具

· 3 min read

创建可访问的应用非常重要,我们很高兴向 DevtronSpectron 推出新功能,让开发者有机会为所有人改进他们的应用。

🌐 Making accessible applications is important and we're happy to introduce new functionality to Devtron and Spectron that gives developers the opportunity to make their apps better for everyone.


Electron 应用的无障碍问题与网站类似,因为它们最终都是 HTML。然而,对于 Electron 应用,你无法使用在线资源进行无障碍审核,因为你的应用没有可以指向审核员的 URL。

🌐 Accessibility concerns in Electron applications are similar to those of websites because they're both ultimately HTML. With Electron apps, however, you can't use the online resources for accessibility audits because your app doesn't have a URL to point the auditor to.

这些新功能将审计工具带到了你的 Electron 应用中。你可以选择在使用 Spectron 的测试中添加审计,或者在 DevTools 中使用 Devtron。阅读下文了解工具的概要,或查看我们的无障碍文档获取更多信息。

🌐 These new features bring those auditing tools to your Electron app. You can choose to add audits to your tests with Spectron or use them within DevTools with Devtron. Read on for a summary of the tools or checkout our accessibility documentation for more information.

Spectron

在测试框架 Spectron 中,你现在可以审核应用中的每个窗口和 <webview> 标签。例如:

🌐 In the testing framework Spectron, you can now audit each window and <webview> tag in your application. For example:

app.client.auditAccessibility().then(function (audit) {
if (audit.failed) {
console.error(audit.message);
}
});

你可以在 Spectron 的文档 中阅读有关此功能的更多信息。

🌐 You can read more about this feature in Spectron's documentation.

Devtron

Devtron 中有一个新的辅助功能选项卡,可让你审核页面在你的应用中,对结果进行排序和筛选。

🌐 In Devtron there is a new accessibility tab which will allow you to audit a page in your app, sort and filter the results.

devtron screenshot

这两种工具都使用了 Google 为 Chrome 构建的 Accessibility Developer Tools 库。你可以在该 仓库的 wiki 上了解该库使用的可访问性审核规则。

🌐 Both of these tools are using the Accessibility Developer Tools library built by Google for Chrome. You can learn more about the accessibility audit rules this library uses on that repository's wiki.

如果你知道其他适用于 Electron 的出色无障碍工具,请通过提交拉取请求将它们添加到 无障碍文档 中。

🌐 If you know of other great accessibility tools for Electron, add them to the accessibility documentation with a pull request.