astro-accessibility
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseAccessibility Rules (WCAG 2.1 AA)
无障碍规则(WCAG 2.1 AA)
This project must meet WCAG 2.1 AA guidelines.
本项目必须符合WCAG 2.1 AA指南要求。
Semantic Structure
语义化结构
- Use semantic HTML: ,
<header>,<nav>,<section>,<article>,<footer>,<ul><li> - Use ARIA roles only when native semantics are not possible (e.g. )
<div role="list">
- 使用语义化HTML:、
<header>、<nav>、<section>、<article>、<footer>、<ul><li> - 仅在原生语义无法实现时使用ARIA角色(例如)
<div role="list">
Images
图片
- Informative images: use the custom component and pass the
<Img>prop, it includes the correct alt textmedia - Functional images/icons (used in buttons or links): use or
altto describe the action/purposearia-label - Decorative images/icons: use and
aria-hidden="true"alt=""
- 信息类图片:使用自定义组件并传入
<Img>属性,该组件已包含正确的替代文本media - 功能类图片/图标(用于按钮或链接中):使用或
alt描述操作/用途aria-label - 装饰类图片/图标:使用和
aria-hidden="true"alt=""
Active State
激活状态
- Use or
aria-current="page"for the current page (e.g. navigation, breadcrumbs)aria-current="location" - Use aria-current for styling:
aria-current:font-semibold
- 对当前页面使用或
aria-current="page"(例如导航、面包屑)aria-current="location" - 利用aria-current进行样式设置:
aria-current:font-semibold
Lists
列表
- Use semantic HTML: ,
<ul>,<ol><li> - For custom components rendering lists, explicitly set ARIA roles:
- on the container
role="list" - on each item
role="listitem"
- 使用语义化HTML:、
<ul>、<ol><li> - 对于渲染列表的自定义组件,需显式设置ARIA角色:
- 在容器上设置
role="list" - 在每个列表项上设置
role="listitem"
- 在容器上设置
Keyboard Navigation
键盘导航
- All functionality must be operable using only the keyboard
- Do not rely solely on hover, drag, or pointer events for core interactions
- 所有功能必须仅通过键盘即可操作
- 核心交互不要仅依赖悬停、拖拽或指针事件
Aria Labels
ARIA标签
- Do NOT hardcode strings for or visually hidden (
aria-label) textsr-only - Always use dynamic labels from the global state:
labels.global['skipToMainContent'] - Select elements must have an accessible name (e.g. tag or
label)aria-label
- 不要为或视觉隐藏(
aria-label)文本硬编码字符串sr-only - 始终使用全局状态中的动态标签:
labels.global['skipToMainContent'] - 选择元素必须有可访问的名称(例如标签或
label)aria-label