508-view 中文文档教程

发布于 6年前 浏览 28 项目主页 更新于 3年前

508 View

508 视图是一个 NPM 包,您可以在开发过程中包含它以帮助评估和改进 您网站的可访问性。 它试图创建一个屏幕阅读器的可视化表示 会看到。 要查看它是如何工作的,请查看演示:

查看演示

Usage

将其添加为 yarn 的开发依赖项:

yarn add -D 508-view

或者,使用 NPM:

npm install --save-dev 508-view

安装后,您需要将其包含在您的站点中。 如果你使用的是 webpack,你可以这样做 类似的东西:

import {ScreenReaderView} from '508-view';
new ScreenReaderView().run();

如果你的代码没有被转译,你可以从 node_modules 文件夹中包含它,比如:

<script src="/node_modules/508-view/lib/508-view.js"></script>

一旦它被包含(你可能需要调整路径以确保你没有 404),你可以运行它 像这样:

var ScreenReaderView = window["508-view"];
new ScreenReaderView().run();

Config

默认情况下,一切都已打开,但除非找到 GET 参数,否则脚本不会执行 508 在 URL 中。 这允许在开发过程中进行简单的切换。

OptionDefaultDescription
"display-aria-visible"trueFinds any elements that are hidden via CSS but are missing an aria-hidden attribute. Sets their display to block.
"highlight-aria-invisible"trueAdds a big red border around elements with aria-hidden set to true, indicating the screen reader can't see them.
"hide-visual-elements"trueSets opacity on image, video, and canvas to 0. Removes background images.
"display-image-alts"trueAdds a green element above images with their alt tag value.
"display-missing-image-alts"trueAdds a red element above image missing alt tags.
"display-sr-only"trueRenders .sr-only text as a blue elements.
"use-helper-styles"trueOverrides background colors to light grey, text to black, makes buttons yellow, adds a pink focus state.
"enable-via-url"trueToggles whether 508 view should be rendered via a GET parameter or should be always rendered.
"url-parameter""508"Sets the URL parameter to enable 508 view. Ignored if enable-via-url is false.
"body-class""test-508"Sets the CSS class that gets added to the body to let you write specific styles for 508 mode.

Warning

这个工具只是为了在开发过程中提供帮助。 它没有经过许多测试 浏览器,不应出于任何原因在生产中使用。

508 View

508 view is an NPM package that you can include during development to help evaluate and improve your site's accessibility. It attempts to create a visual representation of what a screen-reader would see. To see how it works check out the demo:

View the Demo

Usage

Add it as a dev dependency with yarn:

yarn add -D 508-view

Or, use NPM:

npm install --save-dev 508-view

Once it's installed you need to include it in your site. If you're using webpack you can do something like:

import {ScreenReaderView} from '508-view';
new ScreenReaderView().run();

If your code isn't being transpiled, you can include it from the node_modules folder like:

<script src="/node_modules/508-view/lib/508-view.js"></script>

Once its included (you may need to adjust the path to ensure you dont have a 404), you can run it like this:

var ScreenReaderView = window["508-view"];
new ScreenReaderView().run();

Config

By default, everything is turned on but the script won't execute unless it finds the GET parameter 508 in the URL. This allows simple toggling during development.

OptionDefaultDescription
"display-aria-visible"trueFinds any elements that are hidden via CSS but are missing an aria-hidden attribute. Sets their display to block.
"highlight-aria-invisible"trueAdds a big red border around elements with aria-hidden set to true, indicating the screen reader can't see them.
"hide-visual-elements"trueSets opacity on image, video, and canvas to 0. Removes background images.
"display-image-alts"trueAdds a green element above images with their alt tag value.
"display-missing-image-alts"trueAdds a red element above image missing alt tags.
"display-sr-only"trueRenders .sr-only text as a blue elements.
"use-helper-styles"trueOverrides background colors to light grey, text to black, makes buttons yellow, adds a pink focus state.
"enable-via-url"trueToggles whether 508 view should be rendered via a GET parameter or should be always rendered.
"url-parameter""508"Sets the URL parameter to enable 508 view. Ignored if enable-via-url is false.
"body-class""test-508"Sets the CSS class that gets added to the body to let you write specific styles for 508 mode.

Warning

This tool is just meant to help out during the development process. It is not tested across many browsers and shouldn't be used in production for any reason.

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文