From e80a737e6dfee50141a448a57b3c4e4fbf6ac3bc Mon Sep 17 00:00:00 2001 From: Huyue Gu Date: Tue, 19 Mar 2019 23:28:13 -0700 Subject: [PATCH 01/32] Update accessibility.md --- content/docs/accessibility.md | 334 ++++++++++++++++------------------ 1 file changed, 158 insertions(+), 176 deletions(-) diff --git a/content/docs/accessibility.md b/content/docs/accessibility.md index e6cacba3bb..30db04c993 100644 --- a/content/docs/accessibility.md +++ b/content/docs/accessibility.md @@ -1,32 +1,32 @@ --- id: accessibility -title: Accessibility +title: 无障碍辅助功能 permalink: docs/accessibility.html --- -## Why Accessibility? {#why-accessibility} +## 为什么我们需要无障碍辅助功能? {#why-accessibility} -Web accessibility (also referred to as [**a11y**](https://en.wiktionary.org/wiki/a11y)) is the design and creation of websites that can be used by everyone. Accessibility support is necessary to allow assistive technology to interpret web pages. +网络无障碍辅助功能(Accessibility,也被称为 [**a11y**](https://en.wiktionary.org/wiki/a11y),因为以A开头,以Y结尾,一共11个字母)是一种可以帮助所有人获得服务的设计和创造。为了使辅助技术可以正确的解读您的网页,无障碍辅助功能是必要的。 -React fully supports building accessible websites, often by using standard HTML techniques. +React通常使用标准HTML技术来完全支持创建具有可访问性的网站。 -## Standards and Guidelines {#standards-and-guidelines} +## 标准和指引 {#standards-and-guidelines} ### WCAG {#wcag} -The [Web Content Accessibility Guidelines](https://www.w3.org/WAI/intro/wcag) provides guidelines for creating accessible web sites. +[网络内容无障碍指南(Web Content Accessibility Guidelines,WCAG)](https://www.w3.org/WAI/intro/wcag) 为开发无障碍网站提供了指南。 -The following WCAG checklists provide an overview: +下面的 WCAG 检查表提供了一个概览: -- [WCAG checklist from Wuhcag](https://www.wuhcag.com/wcag-checklist/) -- [WCAG checklist from WebAIM](https://webaim.org/standards/wcag/checklist) -- [Checklist from The A11Y Project](https://a11yproject.com/checklist.html) +- [Wuchang提供的WCAG检查表(WCAG checklist from Wuhcag)](https://www.wuhcag.com/wcag-checklist/) +- [WebAIM提供的WCAG检查表(WCAG checklist from WebAIM)](https://webaim.org/standards/wcag/checklist) +- [A11Y Project提供的检查表(Checklist from The A11Y Project)](https://a11yproject.com/checklist.html) ### WAI-ARIA {#wai-aria} -The [Web Accessibility Initiative - Accessible Rich Internet Applications](https://www.w3.org/WAI/intro/aria) document contains techniques for building fully accessible JavaScript widgets. +[网络无障碍倡议 - 无障碍互联网应用(Web Accessibility Initiative - Accessible Rich Internet Applications)](https://www.w3.org/WAI/intro/aria) 文件包含了创建完全无障碍JavaScript部件所需要的技术。 -Note that all `aria-*` HTML attributes are fully supported in JSX. Whereas most DOM properties and attributes in React are camelCased, these attributes should be hyphen-cased (also known as kebab-case, lisp-case, etc) as they are in plain HTML: +注意:JSX 支持所有 `aria-*` HTML 属性。虽然大多数React的DOM变量和属性命名都使用驼峰命名(camelCased),`aria-*` 应该使用带连字符的命名法(也叫诸如hyphen-cased,kebab-case, lisp-case),就像在 HTML 中一样。 ```javascript{3,4} ``` -## Semantic HTML {#semantic-html} -Semantic HTML is the foundation of accessibility in a web application. Using the various HTML elements to reinforce the meaning of information -in our websites will often give us accessibility for free. +## HTML 语义 {#semantic-html} +HTML 语义是无障碍辅助功能网络应用的基础。利用多种HTML元素来强化您网站中的信息通常可以使您直接获得无障碍辅助功能。 -- [MDN HTML elements reference](https://developer.mozilla.org/en-US/docs/Web/HTML/Element) +- [MDN 的 HTML 元素参照(MDN HTML elements reference)](https://developer.mozilla.org/en-US/docs/Web/HTML/Element) -Sometimes we break HTML semantics when we add `
` elements to our JSX to make our React code work, especially when working with lists (`
    `, `
      ` and `
      `) and the HTML ``. -In these cases we should rather use [React Fragments](/docs/fragments.html) to group together multiple elements. +在 JSX 中使用 `
      ` 元素来实现我们的 React 代码功能的时候,尤其当我们使用列表(`
        `, `
          ` 和 `
          `)和 HTML `
      ` 时,HTML 语义会被破坏。 +在这种情况下,我们应该使用 [React Fragments](/docs/fragments.html) 来组合各个组件。 -For example, +举个例子, ```javascript{1,5,8} import React, { Fragment } from 'react'; @@ -73,7 +72,7 @@ function Glossary(props) { } ``` -You can map a collection of items to an array of fragments as you would any other type of element as well: +和其他的元素一样,你可以把一系列的对象映射到一个 fragment 的数组中。 ```javascript{6,9} function Glossary(props) { @@ -91,7 +90,7 @@ function Glossary(props) { } ``` -When you don't need any props on the Fragment tag you can use the [short syntax](/docs/fragments.html#short-syntax), if your tooling supports it: +当你不需要在 fragment 标签中添加任何 prop 且你的工具支持的时候,你可以使用 [短语法](/docs/fragments.html#short-syntax): ```javascript{3,6} function ListItem({ item }) { @@ -104,83 +103,80 @@ function ListItem({ item }) { } ``` -For more info, see [the Fragments documentation](/docs/fragments.html). +更多信息请参见 [Fragments 文档](/docs/fragments.html)。 -## Accessible Forms {#accessible-forms} +## 无障碍表单 {#accessible-forms} -### Labeling {#labeling} -Every HTML form control, such as `` and `