ヘッダー属性を使用する表のセルは、同じ表内のセルのみを参照する必要があります。

ルールID: td-headers-attr
ルールセット: axe-core 4.10
ユーザーへの影響:
ガイドライン: WCAG 2.1 (A), WCAG 2.0 (A), WCAG 2.2 (A), Section 508, Trusted Tester, EN 301 549
 

Need accessibility training?

Deque University offers an extensive curriculum of self-guided online courses for every skillset and experience level.

Compliance Data & Impact

User Impact


Minor
Critical

Disabilities Affected

  • 盲目
  • 盲ろう者

Standard(s)

  • WCAG 2.1 (A)
  • WCAG 2.0 (A)
  • WCAG 2.2 (A)
  • Section 508
  • Trusted Tester
  • EN 301 549

WCAG 達成基準 [WCAG 2.1 (A)]

  • 1.3.1: Info and Relationships

WCAG 達成基準 [WCAG 2.0 (A)]

  • 1.3.1: Info and Relationships

WCAG 達成基準 [WCAG 2.2 (A)]

  • 1.3.1: Info and Relationships

Section 508 ガイドライン

  • 1194.22: Web based intranet and Internet Information & Applications
  • 1194.22 (g): Row and column headers shall be identified for data tables.” and “(h) Markup shall be used to associate data cells and header cells for data tables that have two or more logical levels of row or column headers.

Trusted Tester Guidelines

  • 14.B: All data cells are programmatically associated with relevant headers.

    修正方法

    この問題を解決するには、 headers テーブルを使用する各セルが同じテーブル内の別のセルを参照するように、 scope 要素内の th 要素ごとに tr 属性値を作成します。このルールは、ヘッダー列と行への参照が特定の td 要素に接続されているかどうかをチェックします。

    scope 属性は、列の下のすべてが上部のヘッダーに関連し、行ヘッダーの右側のすべてがそのヘッダーに関連することをブラウザーとスクリーンリーダーに伝えます。

    scope属性をテーブルに適用すると、マークアップは次のようになります。

    <table>
      <caption><strong>Greensprings Running Club Personal Bests</strong></caption>
      <thead>
        <tr>
          <th scope="col">Name</th>
          <th scope="col">1 mile</th>
          <th scope="col">5 km</th>
          <th scope="col">10 km</th>
        </tr>
      </thead>
    
      <tbody>
        <tr>
          <th scope="row">Mary</th>
          <td>8:32</td>
          <td>28:04</td>
          <td>1:01:16</td>
        </tr>
    
        <tr>
          <th scope="row">Betsy</th>
          <td>7:43</td>
          <td>26:47</td>
          <td>55:38</td>
        </tr>
    
        <tr>
          <th scope="row">Matt</th>
          <td>7:55</td>
          <td>27:29</td>
          <td>57:04</td>
        </tr>
    
        <tr>
          <th scope="row">Todd</th>
          <td>7:01</td>
          <td>24:21</td>
          <td>50:35</td>
        </tr>
      </tbody>
    
    </table>

    属性と id 属性を使用してデータ セルをデータ テーブル内のヘッダー セルに関連付ける headers 」を参照してください、データ テーブル内の1つ以上のヘッダー セルにデータ セルを接続する具体的な例については。

    Name、1マイル、5 km、10 kmの上部ヘッダーはすべて th 要素でマークアップされており、Mary、Betsy、Matt、Toddの行ヘッダーも同様であることに注意してください。これらの各ヘッダー セルには、列ヘッダー セルか行ヘッダー セルかに応じて、 scope 属性値 col または row も与えられています。

    colgroup 属性と rowgroup 属性の値 scope を使用することです、ヘッダー セルをデータ セルに関連付けるもう1つの方法は。このマークアップ手法は、複数の列または行にまたがるヘッダーを示すために使用されます。MozillaのLearn HTML Developer Docsにある次の表を検討してください。

    2016年8月に販売された商品
    アクセサリー
    ズボン スカート ドレス ブレスレット リング
    ベルギー アントワープ 56 22 43 72 23
    ゲント 46 18 50 61 15
    ブリュッセル 51 27 38 69 28
    オランダ アムステルダム 89 34 69 85 38
    ユトレヒト 80 12 43 36 19

    scope="colgroup" 要素におよび scope="rowgroup" の値を含める例 th

    <table>
      <caption>Items Sold August 2016</caption>
      <tbody>
        <tr>
          <td></td>
          <td></td>
          <th colspan="3" scope="colgroup">Clothes</th>
          <th colspan="2" scope="colgroup">Accessories</th>
        </tr>
        <tr>
          <td></td>
          <td></td>
          <th scope="col">Trousers</th>
          <th scope="col">Skirts</th>
          <th scope="col">Dresses</th>
          <th scope="col">Bracelets</th>
          <th scope="col">Rings</th>
        </tr>
        <tr>
          <th rowspan="3" scope="rowgroup">Belgium</th>
          <th scope="row">Antwerp</th>
          <td>56</td>
          <td>22</td>
          <td>43</td>
          <td>72</td>
          <td>23</td>
        </tr>
        <tr>
          <th scope="row">Gent</th>
          <td>46</td>
          <td>18</td>
          <td>50</td>
          <td>61</td>
          <td>15</td>
        </tr>
        <tr>
          <th scope="row">Brussels</th>
          <td>51</td>
          <td>27</td>
          <td>38</td>
          <td>69</td>
          <td>28</td>
        </tr>
        <tr>
          <th rowspan="2" scope="rowgroup">The Netherlands</th>
          <th scope="row">Amsterdam</th>
          <td>89</td>
          <td>34</td>
          <td>69</td>
          <td>85</td>
          <td>38</td>
        </tr>
        <tr>
          <th scope="row">Utrecht</th>
          <td>80</td>
          <td>12</td>
          <td>43</td>
          <td>36</td>
          <td>19</td>
        </tr>
      </tbody>
    </table>
    

    なぜ重要なのか

    スクリーン リーダーには、テーブルを読み上げるための特別な方法があります。テーブルが適切にマークアップされていない場合、スクリーン リーダーの出力が混乱したり不正確になったりする可能性があります。

    目の見えるユーザーは、通常、テーブルのヘッダーが何であるか、データとの関係が何であるかを一目で知ることができます。目の見えないユーザーの場合、これはマークアップで行う必要があります。

    データ テーブルがアクセシビリティを考慮して設計されている場合、ユーザーはテーブル ナビゲーション モードに入り、スクリーン リーダーがデータ セルに対応するテーブル ヘッダーを読み上げながら、テーブル内のセル間を移動できます。テーブルヘッダーを読むと、大きなデータテーブル間を移動する場合や、セルに似ていて混同しやすいデータが含まれている場合に特に役立ちます。

    ただし、テーブルにアクセシビリティ機能がない場合、テーブルナビゲーションモードは役に立ちません。

    ルールの説明

    データ テーブルのマークアップは面倒でわかりにくいです。テーブルを意味的に、正しいヘッダー構造でマークアップしてください。スクリーン リーダーにはテーブル ナビゲーションを容易にする機能がありますが、これらの機能が正しく動作するにはテーブルを正確にマークアップする必要があります。

    仕組みについて (簡単に言うと)

    データ テーブルが意味的にマークアップされ、正しいヘッダー構造を持っていることを確認します。

    リソース

    axe 4.10 ルールの一覧 を参照する

    この情報は役に立ちましたか?

    すでにフィードバックをいただきました、ありがとうございます。.

    あなたの回答は次のとおりです。

    この情報は役に立ちましたか?
    フィードバックが提出された日付/時刻: