{"id":268,"date":"2026-09-29T11:15:49","date_gmt":"2026-09-29T03:15:49","guid":{"rendered":"https:\/\/yykcj.com\/?p=268"},"modified":"2026-09-29T11:15:49","modified_gmt":"2026-09-29T03:15:49","slug":"web-%e6%97%a0%e9%9a%9c%e7%a2%8d%e6%9c%80%e4%bd%b3%e5%ae%9e%e8%b7%b5%ef%bc%9a%e4%bb%8e%e5%8f%af%e8%ae%bf%e9%97%ae%e6%80%a7%e6%a0%91%e5%88%b0%e5%ae%9e%e6%88%98%e4%bb%a3%e7%a0%81","status":"publish","type":"post","link":"https:\/\/yykcj.com\/?p=268","title":{"rendered":"Web \u65e0\u969c\u788d\u6700\u4f73\u5b9e\u8df5\uff1a\u4ece\u53ef\u8bbf\u95ee\u6027\u6811\u5230\u5b9e\u6218\u4ee3\u7801"},"content":{"rendered":"<h2>\u4e3a\u4ec0\u4e48\u4f60\u7684\u7f51\u7ad9\u9700\u8981\u65e0\u969c\u788d\u652f\u6301\uff1f<\/h2>\n<p>\u60f3\u8c61\u4e00\u4e0b\uff0c\u4f60\u6b63\u5728\u4f7f\u7528\u4e00\u4e2a\u53ea\u80fd\u901a\u8fc7\u952e\u76d8\u64cd\u4f5c\u7684\u94f6\u884c\u7f51\u7ad9\uff0c\u6216\u8005\u4f60\u662f\u4e00\u4f4d\u89c6\u969c\u7528\u6237\uff0c\u4f9d\u8d56\u5c4f\u5e55\u9605\u8bfb\u5668\u6d4f\u89c8\u65b0\u95fb\u3002\u5982\u679c\u7f51\u7ad9\u6ca1\u6709\u8003\u8651\u65e0\u969c\u788d\uff08Accessibility\uff0c\u7b80\u79f0 A11y\uff09\uff0c\u8fd9\u4e9b\u7528\u6237\u5c06\u65e0\u6cd5\u5b8c\u6210\u4efb\u52a1\u3002\u5168\u7403\u6709\u8d85\u8fc7 10 \u4ebf\u6b8b\u969c\u4eba\u58eb\uff0c\u65e0\u969c\u788d\u4e0d\u4ec5\u662f\u9053\u5fb7\u8d23\u4efb\uff0c\u4e5f\u662f\u6cd5\u5f8b\u8981\u6c42\uff08\u5982 WCAG\u3001ADA\uff09\u3002\u66f4\u91cd\u8981\u7684\u662f\uff0c\u826f\u597d\u7684\u65e0\u969c\u788d\u5b9e\u8df5\u80fd\u63d0\u5347\u6240\u6709\u7528\u6237\u7684\u4f53\u9a8c\uff1a\u66f4\u6e05\u6670\u7684\u8bed\u4e49\u3001\u66f4\u597d\u7684\u952e\u76d8\u652f\u6301\u3001\u66f4\u5feb\u7684\u52a0\u8f7d\u901f\u5ea6\u3002<\/p>\n<p>\u672c\u6587\u5c06\u4ece\u53ef\u8bbf\u95ee\u6027\u6811\uff08Accessibility Tree\uff09\u8bb2\u8d77\uff0c\u901a\u8fc7\u4e00\u4e2a\u5b8c\u6574\u7684\u5b9e\u6218\u6848\u4f8b\uff0c\u5e26\u4f60\u4e00\u6b65\u6b65\u5b9e\u73b0\u7b26\u5408 WCAG 2.1 AA \u6807\u51c6\u7684 Web \u5e94\u7528\u3002<\/p>\n<h2>1. \u7406\u89e3\u53ef\u8bbf\u95ee\u6027\u6811\uff1a\u6d4f\u89c8\u5668\u5982\u4f55\u201c\u770b\u201d\u4f60\u7684\u9875\u9762<\/h2>\n<p>\u6d4f\u89c8\u5668\u5728\u6e32\u67d3 DOM \u7684\u540c\u65f6\uff0c\u4f1a\u6784\u5efa\u4e00\u68f5<strong>\u53ef\u8bbf\u95ee\u6027\u6811<\/strong>\uff08Accessibility Tree\uff09\uff0c\u8f85\u52a9\u6280\u672f\uff08\u5982\u5c4f\u5e55\u9605\u8bfb\u5668\uff09\u6b63\u662f\u901a\u8fc7\u8fd9\u68f5\u6811\u6765\u7406\u89e3\u9875\u9762\u5185\u5bb9\u3002\u5982\u679c\u5143\u7d20\u6ca1\u6709\u6b63\u786e\u7684\u89d2\u8272\uff08role\uff09\u3001\u540d\u79f0\uff08name\uff09\u548c\u72b6\u6001\uff08state\uff09\uff0c\u5c4f\u5e55\u9605\u8bfb\u5668\u5c31\u65e0\u6cd5\u4f20\u8fbe\u4fe1\u606f\u3002<\/p>\n<p><strong>\u5173\u952e\u70b9<\/strong>\uff1a\u8bed\u4e49\u5316 HTML \u5143\u7d20\uff08\u5982 <code><button><\/code>\u3001<code><\/p>\n<nav><\/code>\u3001<code><main><\/code>\uff09\u4f1a\u81ea\u52a8\u6620\u5c04\u5230\u53ef\u8bbf\u95ee\u6027\u6811\u4e2d\u7684\u89d2\u8272\u3002\u800c <code><\/p>\n<div><\/code> \u548c <code><span><\/code> \u9ed8\u8ba4\u6ca1\u6709\u89d2\u8272\uff0c\u9700\u8981\u624b\u52a8\u6dfb\u52a0 ARIA \u5c5e\u6027\u3002<\/p>\n<h2>2. \u8bed\u4e49\u5316 HTML\uff1a\u6700\u57fa\u7840\u4e5f\u6700\u91cd\u8981\u7684\u5b9e\u8df5<\/h2>\n<h3>2.1 \u4f7f\u7528\u6b63\u786e\u7684\u5143\u7d20<\/h3>\n<p>\u9519\u8bef\u793a\u4f8b\uff1a<\/p>\n<pre><code class=\"language-html\">\n&lt;div onclick=&quot;submitForm()&quot;&gt;\u63d0\u4ea4&lt;\/div&gt;\n<\/code><\/pre>\n<p>\u6b63\u786e\u793a\u4f8b\uff1a<\/p>\n<pre><code class=\"language-html\">\n&lt;button type=&quot;submit&quot;&gt;\u63d0\u4ea4&lt;\/button&gt;\n<\/code><\/pre>\n<p><code><button><\/code> \u81ea\u5e26\u952e\u76d8\u652f\u6301\uff08Enter\/Space \u89e6\u53d1\uff09\u3001\u7126\u70b9\u7ba1\u7406\u548c\u6b63\u786e\u7684\u89d2\u8272\uff08button\uff09\u3002\u800c <code><\/p>\n<div><\/code> \u9700\u8981\u624b\u52a8\u6dfb\u52a0 <code>tabindex=\"0\"<\/code>\u3001<code>role=\"button\"<\/code> \u548c\u952e\u76d8\u4e8b\u4ef6\u76d1\u542c\uff0c\u4e14\u5bb9\u6613\u9057\u6f0f\u3002<\/p>\n<h3>2.2 \u6587\u6863\u7ed3\u6784\u6807\u7b7e<\/h3>\n<p>\u4f7f\u7528 <code><\/p>\n<header><\/code>\u3001<code><\/p>\n<nav><\/code>\u3001<code><main><\/code>\u3001<code><\/p>\n<aside><\/code>\u3001<code><\/p>\n<footer><\/code> \u7b49\u5730\u6807\u5143\u7d20\uff0c\u5c4f\u5e55\u9605\u8bfb\u5668\u7528\u6237\u53ef\u4ee5\u5feb\u901f\u8df3\u8f6c\u5230\u4e0d\u540c\u533a\u57df\u3002<\/p>\n<pre><code class=\"language-html\">\n&lt;body&gt;\n  &lt;header&gt;\n    &lt;h1&gt;\u6211\u7684\u7f51\u7ad9&lt;\/h1&gt;\n  &lt;\/header&gt;\n  &lt;nav aria-label=&quot;\u4e3b\u5bfc\u822a&quot;&gt;\n    &lt;ul&gt;\n      &lt;li&gt;&lt;a href=&quot;\/&quot;&gt;\u9996\u9875&lt;\/a&gt;&lt;\/li&gt;\n      &lt;li&gt;&lt;a href=&quot;\/about&quot;&gt;\u5173\u4e8e&lt;\/a&gt;&lt;\/li&gt;\n    &lt;\/ul&gt;\n  &lt;\/nav&gt;\n  &lt;main&gt;\n    &lt;h2&gt;\u6b22\u8fce&lt;\/h2&gt;\n    &lt;p&gt;\u5185\u5bb9...&lt;\/p&gt;\n  &lt;\/main&gt;\n  &lt;footer&gt;\n    &lt;p&gt;&amp;copy; 2025&lt;\/p&gt;\n  &lt;\/footer&gt;\n&lt;\/body&gt;\n<\/code><\/pre>\n<p>\ud83d\udca1 <strong>\u6ce8\u610f<\/strong>\uff1a\u4e00\u4e2a\u9875\u9762\u53ea\u5e94\u6709\u4e00\u4e2a <code><main><\/code>\uff0c\u4e14\u6bcf\u4e2a <code><\/p>\n<nav><\/code> \u6700\u597d\u7528 <code>aria-label<\/code> \u533a\u5206\uff08\u5982\u201c\u4e3b\u5bfc\u822a\u201d\u3001\u201c\u9762\u5305\u5c51\u201d\uff09\u3002<\/p>\n<h2>3. ARIA \u5c5e\u6027\uff1a\u7528\u5bf9\u662f\u9526\u4e0a\u6dfb\u82b1\uff0c\u7528\u9519\u662f\u96ea\u4e0a\u52a0\u971c<\/h2>\n<p>ARIA\uff08Accessible Rich Internet Applications\uff09\u53ef\u4ee5\u8865\u5145\u8bed\u4e49\uff0c\u4f46<strong>\u7b2c\u4e00\u6761\u89c4\u5219\u662f\uff1a\u4e0d\u8981\u7528 ARIA \u66ff\u4ee3\u539f\u751f HTML<\/strong>\u3002<\/p>\n<h3>3.1 \u5e38\u89c1 ARIA \u5c5e\u6027<\/h3>\n<ul>\n<li><code>aria-label<\/code>\uff1a\u4e3a\u5143\u7d20\u63d0\u4f9b\u6587\u672c\u6807\u7b7e\uff08\u5f53\u89c6\u89c9\u6587\u672c\u4e0d\u5145\u5206\u65f6\uff09\u3002<\/li>\n<li><code>aria-labelledby<\/code>\uff1a\u901a\u8fc7\u5176\u4ed6\u5143\u7d20\u7684 id \u6765\u547d\u540d\u5f53\u524d\u5143\u7d20\u3002<\/li>\n<li><code>aria-describedby<\/code>\uff1a\u63d0\u4f9b\u989d\u5916\u63cf\u8ff0\u3002<\/li>\n<li><code>aria-hidden=\"true\"<\/code>\uff1a\u5bf9\u8f85\u52a9\u6280\u672f\u9690\u85cf\u5143\u7d20\uff08\u7528\u4e8e\u88c5\u9970\u6027\u5185\u5bb9\uff09\u3002<\/li>\n<li><code>aria-live<\/code>\uff1a\u52a8\u6001\u5185\u5bb9\u66f4\u65b0\u65f6\u901a\u77e5\u5c4f\u5e55\u9605\u8bfb\u5668\u3002<\/li>\n<\/ul>\n<h3>3.2 \u5b9e\u6218\uff1a\u53ef\u8bbf\u95ee\u7684\u6a21\u6001\u5bf9\u8bdd\u6846<\/h3>\n<p>\u6a21\u6001\u5bf9\u8bdd\u6846\u662f\u65e0\u969c\u788d\u7684\u91cd\u707e\u533a\u3002\u4e0b\u9762\u662f\u4e00\u4e2a\u7b26\u5408 WAI-ARIA \u89c4\u8303\u7684\u5b9e\u73b0\uff1a<\/p>\n<pre><code class=\"language-html\">\n&lt;div role=&quot;dialog&quot; aria-modal=&quot;true&quot; aria-labelledby=&quot;dialog-title&quot; id=&quot;dialog&quot;&gt;\n  &lt;h2 id=&quot;dialog-title&quot;&gt;\u786e\u8ba4\u5220\u9664&lt;\/h2&gt;\n  &lt;p&gt;\u786e\u5b9a\u8981\u5220\u9664\u8fd9\u6761\u8bb0\u5f55\u5417\uff1f\u6b64\u64cd\u4f5c\u4e0d\u53ef\u64a4\u9500\u3002&lt;\/p&gt;\n  &lt;button id=&quot;cancel-btn&quot;&gt;\u53d6\u6d88&lt;\/button&gt;\n  &lt;button id=&quot;confirm-btn&quot;&gt;\u5220\u9664&lt;\/button&gt;\n&lt;\/div&gt;\n<\/code><\/pre>\n<pre><code class=\"language-javascript\">\nconst dialog = document.getElementById(&#x27;dialog&#x27;);\nconst cancelBtn = document.getElementById(&#x27;cancel-btn&#x27;);\nconst confirmBtn = document.getElementById(&#x27;confirm-btn&#x27;);\nconst previousFocus = document.activeElement;\n\nfunction openDialog() {\n  dialog.style.display = &#x27;block&#x27;;\n  dialog.setAttribute(&#x27;aria-hidden&#x27;, &#x27;false&#x27;);\n  \/\/ \u5c06\u7126\u70b9\u79fb\u5230\u5bf9\u8bdd\u6846\u5185\u7b2c\u4e00\u4e2a\u53ef\u805a\u7126\u5143\u7d20\n  cancelBtn.focus();\n  \/\/ \u76d1\u542c\u952e\u76d8\u4e8b\u4ef6\n  document.addEventListener(&#x27;keydown&#x27;, handleKeyDown);\n}\n\nfunction closeDialog() {\n  dialog.style.display = &#x27;none&#x27;;\n  dialog.setAttribute(&#x27;aria-hidden&#x27;, &#x27;true&#x27;);\n  document.removeEventListener(&#x27;keydown&#x27;, handleKeyDown);\n  \/\/ \u6062\u590d\u4e4b\u524d\u7684\u7126\u70b9\n  if (previousFocus) previousFocus.focus();\n}\n\nfunction handleKeyDown(e) {\n  if (e.key === &#x27;Escape&#x27;) {\n    closeDialog();\n  }\n  \/\/ \u7126\u70b9\u9677\u9631\uff1aTab \u952e\u5faa\u73af\u5728\u5bf9\u8bdd\u6846\u5185\n  if (e.key === &#x27;Tab&#x27;) {\n    const focusable = dialog.querySelectorAll(&#x27;button, [href], input, select, textarea, [tabindex]:not([tabindex=&quot;-1&quot;])&#x27;);\n    const first = focusable[0];\n    const last = focusable[focusable.length - 1];\n    if (e.shiftKey &amp;&amp; document.activeElement === first) {\n      e.preventDefault();\n      last.focus();\n    } else if (!e.shiftKey &amp;&amp; document.activeElement === last) {\n      e.preventDefault();\n      first.focus();\n    }\n  }\n}\n\ncancelBtn.addEventListener(&#x27;click&#x27;, closeDialog);\nconfirmBtn.addEventListener(&#x27;click&#x27;, () =&gt; {\n  \/\/ \u6267\u884c\u5220\u9664\u64cd\u4f5c\n  closeDialog();\n});\n\n\/\/ \u6253\u5f00\u5bf9\u8bdd\u6846\u7684\u6309\u94ae\nopenDialog();\n<\/code><\/pre>\n<p>\ud83d\udca1 <strong>\u6ce8\u610f<\/strong>\uff1a\u6a21\u6001\u5bf9\u8bdd\u6846\u5fc5\u987b\u7ba1\u7406\u7126\u70b9\uff0c\u5426\u5219\u5c4f\u5e55\u9605\u8bfb\u5668\u7528\u6237\u4f1a\u8ff7\u5931\u5728\u80cc\u666f\u5185\u5bb9\u4e2d\u3002<code>aria-modal=\"true\"<\/code> \u544a\u8bc9\u8f85\u52a9\u6280\u672f\u5ffd\u7565\u80cc\u666f\u5185\u5bb9\u3002<\/p>\n<h2>4. \u952e\u76d8\u5bfc\u822a\uff1a\u8ba9\u6240\u6709\u529f\u80fd\u53ef\u89e6\u8fbe<\/h2>\n<p>\u6240\u6709\u4ea4\u4e92\u5143\u7d20\u5fc5\u987b\u53ef\u4ee5\u901a\u8fc7\u952e\u76d8\u8bbf\u95ee\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c<code><a><\/code>\u3001<code><button><\/code>\u3001<code><input><\/code> \u7b49\u662f\u53ef\u805a\u7126\u7684\uff0c\u4f46\u81ea\u5b9a\u4e49\u7ec4\u4ef6\u9700\u8981\u663e\u5f0f\u8bbe\u7f6e <code>tabindex<\/code>\u3002<\/p>\n<h3>4.1 \u7ba1\u7406 tabindex<\/h3>\n<ul>\n<li><code>tabindex=\"0\"<\/code>\uff1a\u5143\u7d20\u53ef\u805a\u7126\uff0c\u4e14\u6309 DOM \u987a\u5e8f\u53c2\u4e0e Tab \u5bfc\u822a\u3002<\/li>\n<li><code>tabindex=\"-1\"<\/code>\uff1a\u5143\u7d20\u53ef\u805a\u7126\uff0c\u4f46\u53ea\u80fd\u901a\u8fc7 JavaScript \u805a\u7126\uff08\u7528\u4e8e\u7a0b\u5e8f\u5316\u7126\u70b9\u7ba1\u7406\uff09\u3002<\/li>\n<li>\u907f\u514d\u4f7f\u7528 <code>tabindex<\/code> \u5927\u4e8e 0 \u7684\u503c\uff0c\u5b83\u4f1a\u6253\u4e71\u81ea\u7136\u987a\u5e8f\u3002<\/li>\n<\/ul>\n<h3>4.2 \u8df3\u8fc7\u5bfc\u822a\u94fe\u63a5<\/h3>\n<p>\u4e3a\u952e\u76d8\u7528\u6237\u63d0\u4f9b\u201c\u8df3\u5230\u4e3b\u5185\u5bb9\u201d\u7684\u94fe\u63a5\uff1a<\/p>\n<pre><code class=\"language-html\">\n&lt;a href=&quot;#main-content&quot; class=&quot;skip-link&quot;&gt;\u8df3\u5230\u4e3b\u5185\u5bb9&lt;\/a&gt;\n&lt;!-- \u5176\u4ed6\u5bfc\u822a --&gt;\n&lt;main id=&quot;main-content&quot;&gt;...&lt;\/main&gt;\n<\/code><\/pre>\n<pre><code class=\"language-css\">\n.skip-link {\n  position: absolute;\n  top: -40px;\n  left: 0;\n  background: #000;\n  color: #fff;\n  padding: 8px;\n  z-index: 100;\n}\n.skip-link:focus {\n  top: 0;\n}\n<\/code><\/pre>\n<h2>5. \u989c\u8272\u5bf9\u6bd4\u5ea6\u4e0e\u89c6\u89c9\u8bbe\u8ba1<\/h2>\n<p>WCAG 2.1 AA \u8981\u6c42\u6b63\u5e38\u6587\u672c\u5bf9\u6bd4\u5ea6\u81f3\u5c11 4.5:1\uff0c\u5927\u6587\u672c\uff0818pt \u6216 14pt \u7c97\u4f53\uff09\u81f3\u5c11 3:1\u3002\u4f7f\u7528\u5de5\u5177\u5982 WebAIM Contrast Checker \u9a8c\u8bc1\u3002<\/p>\n<pre><code class=\"language-css\">\n\/* \u4e0d\u597d\u7684\u4f8b\u5b50\uff1a\u5bf9\u6bd4\u5ea6\u4e0d\u8db3 *\/\n.low-contrast {\n  color: #999;\n  background: #fff; \/* \u5bf9\u6bd4\u5ea6\u7ea6 2.8:1 *\/\n}\n\n\/* \u597d\u7684\u4f8b\u5b50 *\/\n.good-contrast {\n  color: #333;\n  background: #fff; \/* \u5bf9\u6bd4\u5ea6\u7ea6 12.6:1 *\/\n}\n<\/code><\/pre>\n<p>\ud83d\udca1 <strong>\u6ce8\u610f<\/strong>\uff1a\u4e0d\u8981\u4ec5\u9760\u989c\u8272\u4f20\u8fbe\u4fe1\u606f\uff08\u5982\u7ea2\u8272\u8868\u793a\u9519\u8bef\uff09\u3002\u5e94\u540c\u65f6\u4f7f\u7528\u56fe\u6807\u6216\u6587\u672c\u3002<\/p>\n<h2>6. \u8868\u5355\u65e0\u969c\u788d\uff1a\u6807\u7b7e\u3001\u9519\u8bef\u63d0\u793a\u4e0e\u5206\u7ec4<\/h2>\n<h3>6.1 \u663e\u5f0f\u5173\u8054\u6807\u7b7e<\/h3>\n<pre><code class=\"language-html\">\n&lt;label for=&quot;username&quot;&gt;\u7528\u6237\u540d&lt;\/label&gt;\n&lt;input type=&quot;text&quot; id=&quot;username&quot; name=&quot;username&quot; aria-required=&quot;true&quot;&gt;\n<\/code><\/pre>\n<h3>6.2 \u9519\u8bef\u63d0\u793a<\/h3>\n<pre><code class=\"language-html\">\n&lt;label for=&quot;email&quot;&gt;\u90ae\u7bb1&lt;\/label&gt;\n&lt;input type=&quot;email&quot; id=&quot;email&quot; aria-describedby=&quot;email-error&quot; aria-invalid=&quot;true&quot;&gt;\n&lt;span id=&quot;email-error&quot; role=&quot;alert&quot;&gt;\u8bf7\u8f93\u5165\u6709\u6548\u7684\u90ae\u7bb1\u5730\u5740&lt;\/span&gt;\n<\/code><\/pre>\n<p><code>role=\"alert\"<\/code> \u4f1a\u7acb\u5373\u901a\u77e5\u5c4f\u5e55\u9605\u8bfb\u5668\u3002<\/p>\n<h3>6.3 \u5b57\u6bb5\u96c6\u5206\u7ec4<\/h3>\n<pre><code class=\"language-html\">\n&lt;fieldset&gt;\n  &lt;legend&gt;\u9009\u62e9\u4f60\u7684\u5174\u8da3&lt;\/legend&gt;\n  &lt;input type=&quot;checkbox&quot; id=&quot;coding&quot; name=&quot;interest&quot; value=&quot;coding&quot;&gt;\n  &lt;label for=&quot;coding&quot;&gt;\u7f16\u7a0b&lt;\/label&gt;\n  &lt;input type=&quot;checkbox&quot; id=&quot;design&quot; name=&quot;interest&quot; value=&quot;design&quot;&gt;\n  &lt;label for=&quot;design&quot;&gt;\u8bbe\u8ba1&lt;\/label&gt;\n&lt;\/fieldset&gt;\n<\/code><\/pre>\n<h2>7. \u52a8\u6001\u5185\u5bb9\u4e0e ARIA Live Regions<\/h2>\n<p>\u5f53\u9875\u9762\u5185\u5bb9\u52a8\u6001\u66f4\u65b0\uff08\u5982\u641c\u7d22\u7ed3\u679c\u3001\u901a\u77e5\uff09\uff0c\u4f7f\u7528 <code>aria-live<\/code> \u8ba9\u5c4f\u5e55\u9605\u8bfb\u5668\u64ad\u62a5\u3002<\/p>\n<pre><code class=\"language-html\">\n&lt;div aria-live=&quot;polite&quot; id=&quot;status&quot;&gt;&lt;\/div&gt;\n&lt;script&gt;\n  \/\/ \u51e0\u79d2\u540e\u66f4\u65b0\n  setTimeout(() =&gt; {\n    document.getElementById(&#x27;status&#x27;).textContent = &#x27;\u5df2\u4fdd\u5b58 3 \u6761\u8bb0\u5f55&#x27;;\n  }, 2000);\n&lt;\/script&gt;\n<\/code><\/pre>\n<ul>\n<li><code>polite<\/code>\uff1a\u7b49\u5f85\u7528\u6237\u7a7a\u95f2\u65f6\u64ad\u62a5\u3002<\/li>\n<li><code>assertive<\/code>\uff1a\u7acb\u5373\u6253\u65ad\u64ad\u62a5\uff08\u7528\u4e8e\u7d27\u6025\u9519\u8bef\uff09\u3002<\/li>\n<\/ul>\n<h2>8. \u6d4b\u8bd5\u4f60\u7684\u65e0\u969c\u788d\u5b9e\u73b0<\/h2>\n<h3>8.1 \u81ea\u52a8\u5316\u5de5\u5177<\/h3>\n<ul>\n<li><strong>axe DevTools<\/strong>\uff1a\u6d4f\u89c8\u5668\u6269\u5c55\uff0c\u5feb\u901f\u626b\u63cf\u95ee\u9898\u3002<\/li>\n<li><strong>Lighthouse<\/strong>\uff1aChrome \u5185\u7f6e\uff0c\u751f\u6210\u65e0\u969c\u788d\u62a5\u544a\u3002<\/li>\n<li><strong>Pa11y<\/strong>\uff1a\u547d\u4ee4\u884c\u5de5\u5177\uff0c\u53ef\u96c6\u6210 CI\u3002<\/li>\n<\/ul>\n<h3>8.2 \u624b\u52a8\u6d4b\u8bd5<\/h3>\n<ul>\n<li>\u4ec5\u7528\u952e\u76d8\u64cd\u4f5c\uff1aTab\u3001Shift+Tab\u3001Enter\u3001Space\u3001\u65b9\u5411\u952e\u3002<\/li>\n<li>\u4f7f\u7528\u5c4f\u5e55\u9605\u8bfb\u5668\uff1aNVDA\uff08Windows\uff09\u3001VoiceOver\uff08Mac\uff09\u3001Orca\uff08Linux\uff09\u3002<\/li>\n<li>\u653e\u5927\u5230 200% \u68c0\u67e5\u5e03\u5c40\u3002<\/li>\n<\/ul>\n<h3>8.3 \u5728 CI \u4e2d\u52a0\u5165\u65e0\u969c\u788d\u6d4b\u8bd5<\/h3>\n<pre><code class=\"language-json\">\n\/\/ package.json\n{\n  &quot;scripts&quot;: {\n    &quot;test:a11y&quot;: &quot;pa11y-ci --sitemap https:\/\/example.com\/sitemap.xml&quot;\n  }\n}\n<\/code><\/pre>\n<h2>9. \u5e38\u89c1\u5751\u4e0e\u6700\u4f73\u5b9e\u8df5\u603b\u7ed3<\/h2>\n<ul>\n<li><strong>\u4e0d\u8981\u7528 ARIA \u4fee\u590d\u8bed\u4e49\u5316 HTML \u7684\u95ee\u9898<\/strong>\uff1a\u4f18\u5148\u4f7f\u7528\u539f\u751f\u5143\u7d20\u3002<\/li>\n<li><strong>\u4e0d\u8981\u9690\u85cf\u7126\u70b9\u8f6e\u5ed3<\/strong>\uff1a\u9664\u975e\u63d0\u4f9b\u66ff\u4ee3\u6837\u5f0f\u3002<\/li>\n<li><strong>\u4e0d\u8981\u6ee5\u7528 <code>aria-hidden<\/code><\/strong>\uff1a\u5b83\u4f1a\u9690\u85cf\u5185\u5bb9\uff0c\u4f46\u53ef\u80fd\u8ba9\u53ef\u805a\u7126\u5143\u7d20\u4e0d\u53ef\u89c1\u3002<\/li>\n<li><strong>\u786e\u4fdd\u6240\u6709\u529f\u80fd\u53ef\u901a\u8fc7\u952e\u76d8\u8bbf\u95ee<\/strong>\u3002<\/li>\n<li><strong>\u63d0\u4f9b\u8db3\u591f\u7684\u989c\u8272\u5bf9\u6bd4\u5ea6<\/strong>\u3002<\/li>\n<li><strong>\u4e3a\u56fe\u7247\u63d0\u4f9b <code>alt<\/code> \u6587\u672c<\/strong>\uff1a\u88c5\u9970\u6027\u56fe\u7247\u7528 <code>alt=\"\"<\/code>\u3002<\/li>\n<li><strong>\u6d4b\u8bd5\u3001\u6d4b\u8bd5\u3001\u518d\u6d4b\u8bd5<\/strong>\uff1a\u81ea\u52a8\u5316 + \u624b\u52a8\u3002<\/li>\n<\/ul>\n<h2>10. \u5ef6\u4f38\u9605\u8bfb<\/h2>\n<ul>\n<li><a href=\"https:\/\/www.w3.org\/WAI\/WCAG21\/quickref\/\">WCAG 2.1 \u5feb\u901f\u53c2\u8003<\/a><\/li>\n<li><a href=\"https:\/\/developer.mozilla.org\/zh-CN\/docs\/Web\/Accessibility\">MDN \u65e0\u969c\u788d\u6307\u5357<\/a><\/li>\n<li><a href=\"https:\/\/www.a11yproject.com\/checklist\/\">A11y Project Checklist<\/a><\/li>\n<\/ul>\n<p>\u65e0\u969c\u788d\u4e0d\u662f\u4e00\u6b21\u6027\u4efb\u52a1\uff0c\u800c\u662f\u6301\u7eed\u7684\u8fc7\u7a0b\u3002\u4ece\u4eca\u5929\u5f00\u59cb\uff0c\u5728\u4f60\u7684\u9879\u76ee\u4e2d\u52a0\u5165\u4e00\u4e2a\u8df3\u8fc7\u94fe\u63a5\u3001\u68c0\u67e5\u5bf9\u6bd4\u5ea6\u3001\u7528\u952e\u76d8\u8d70\u4e00\u904d\u6d41\u7a0b\uff0c\u4f60\u5c31\u5df2\u7ecf\u8fc8\u51fa\u4e86\u91cd\u8981\u4e00\u6b65\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u672c\u6587\u6df1\u5165\u8bb2\u89e3 Web \u65e0\u969c\u788d\uff08A11y\uff09\u7684\u6838\u5fc3\u6982\u5ff5\u4e0e\u6700\u4f73\u5b9e\u8df5\uff0c\u901a\u8fc7\u53ef\u8fd0\u884c\u4ee3\u7801\u793a\u4f8b\uff0c\u5e26\u4f60\u638c\u63e1\u8bed\u4e49\u5316 HTML\u3001ARIA \u5c5e\u6027\u3001\u952e\u76d8\u5bfc\u822a\u548c\u5c4f\u5e55\u9605\u8bfb\u5668\u6d4b\u8bd5\uff0c\u6784\u5efa\u5bf9\u6240\u6709\u4eba\u53cb\u597d\u7684 Web \u5e94\u7528\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,4],"tags":[68,69,71,246,36],"class_list":["post-268","post","type-post","status-publish","format-standard","hentry","category-3","category-4","tag-a11y","tag-aria","tag-wcag","tag-web","tag-36"],"_links":{"self":[{"href":"https:\/\/yykcj.com\/index.php?rest_route=\/wp\/v2\/posts\/268","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/yykcj.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/yykcj.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/yykcj.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/yykcj.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=268"}],"version-history":[{"count":0,"href":"https:\/\/yykcj.com\/index.php?rest_route=\/wp\/v2\/posts\/268\/revisions"}],"wp:attachment":[{"href":"https:\/\/yykcj.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=268"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/yykcj.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=268"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/yykcj.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=268"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}