diff --git a/techniques/aria/ARIA24.html b/techniques/aria/ARIA24.html index 74ec62356..d3c300fb2 100644 --- a/techniques/aria/ARIA24.html +++ b/techniques/aria/ARIA24.html @@ -1,6 +1,6 @@ -
このWCAG 2.2 テクニック集の日本語訳は作業中となっています。WCAG 2.1 達成方法集の日本語訳をご利用いただけます。[ WCAG 2.1 達成方法集 ]
role="img"
- This technique relates to - -1.3.1: Info and Relationships -(Sufficient).
This technique applies to content using WAI-ARIA.
このテクニックは、WAI-ARIA を用いる HTMLに適用される。
The objective of this technique is to show how to semantically identify an element that uses a font file for icons. When a user overrides font-family these icons typically disappear unless there is a means to identify them. The point is to provide a technique to differentiate icon fonts from general font (text) usage.
このテクニックの目的は、アイコンにフォントファイルが使用されている要素を、意味的に識別する方法を示すことである。利用者がフォントファミリーを上書きすると、識別する手段がない限りそのアイコンは消える。つまり、アイコンフォントを一般的なフォント(テキスト)の使用法と区別する手段を提供する。
Some low vision users need user stylesheets, scripts, or extensions to override the fonts on a page to perceive text content. However, they need to be able to perceive icon fonts that are meaningful, such as a star signifying a favorite, or an email icon in a link.
一部のロービジョンの利用者は、テキストコンテンツを認識するためにユーザスタイルシート、スクリプト、又は拡張機能を使いページ上のフォントを上書きする必要がある。しかし、お気に入りを示す星やリンク内のメールアイコンなど、意味のあるアイコンフォントは認識できる必要がある。
The key is for the author to semantically markup icon fonts with role="img". Then the user's font replacement selector can hook into that semantic and exclude role="img". This results in those icon fonts being shown.
重要なのは、コンテンツ制作者が role="img" を使用してアイコンフォントを意味的にマークアップすることである。これにより利用者のフォント置換セレクタはそのセマンティックにフックして role="img" を除外できる。この結果、アイコンフォントは表示されたままとなる。
The first step is used for adding a font face with icons via the CSS file.
最初に、 CSS ファイルでアイコンのフォントを追加する。
/* specify font-family name for icons */ @font-face { font-family: 'IconFontRoleImg'; } @@ -125,30 +118,30 @@ 1. Author adds a font-face to the CSS /* specific class for icon */ .icon-star-bg:before { content: "\e982"; }
The second step adds classes, the role="img" attribute for semantics and an accessible name.
次に、クラス、意味的な属性である role="img"、そしてアクセシブルな名前 (accessible name) を追加する。
<!-- icon via class names, role="img" and a text alternative --> <p> <span class="icon icon-star-bg" role="img" aria-label="Favorite"></span> </p>
The third step uses the ":not selector" in combination with the "[attribute] selector" to only replace font faces for regular text.
最後に、 ":not セレクタ" と "[属性] セレクタ" を組み合わせて使用し、通常のテキストのフォントを置き換える。
/* replaces font faces but excludes all elements with attribute role="img" */ *:not([role="img"]) { font-family: Verdana, sans-serif !important; }
In this example a star icon is used to indicate a favorite. It is not interactive and does not disappear if the user overrides the font family via CSS.
この例では星のアイコンがお気に入りを示すものとして使われる。インタラクティブではなく、かつ、利用者がCSSでフォントファミリーを上書きしても消えることはない。
/* default class for fonts-face with icons */ .icon { font-family: 'IconFontRoleImg' !important; } @@ -158,36 +151,36 @@ Author CSS HTML - - Instead of... - + - 次ではなく... - <p> <span class="icon icon-star-bg"></span> </p> - - Do... - + - 次とする... - <p> <span class="icon icon-star-bg" role="img" aria-label="Favorite"></span> </p> - User CSS + 利用者の CSS *:not([role="img"]) { font-family: Verdana, sans-serif !important; } - Working example: + 動作例: - Star Icon Font used as an indicator (not interactive) + 指標として使われる星のアイコン (インタラクティブではない)
<p> <span class="icon icon-star-bg"></span> </p>
<p> <span class="icon icon-star-bg" role="img" aria-label="Favorite"></span> </p>
*:not([role="img"]) { font-family: Verdana, sans-serif !important; }
- Star Icon Font used as an indicator (not interactive) + 指標として使われる星のアイコン (インタラクティブではない)
In this example a two colored star icon is created by stacking two fonts with different colors on top of each other. This way it's possible to mimic only half the star is filled. It is not interactive and does not disappear if the user overrides the font family via CSS.
この例では、異なる色のフォントを重ね合わせて 2 色の星のアイコンを作成する。このようにすると、星の半分までを示しているように見せることができる。インタラクティブではなく、かつ、利用者がCSSでフォントファミリーを上書きしても消えることはない。
/* default class for fonts-face with icons */ .icon { font-family: 'IconFontRoleImg' !important; } @@ -198,14 +191,14 @@ Author CSS HTML - - Instead of... - + - 次ではなく... - <span class="icon-stacked"> <span class="icon icon-star-bg grey"></span> <span class="icon icon-star-half yellow"></span> </span> - - Do... - + - 次とする... - <span class="icon-stacked" role="img" aria-label="Favorite star half filled"> <span class="icon icon-star-bg grey" role="img" aria-hidden="true"></span> <span class="icon icon-star-half yellow" role="img" aria-hidden="true"></span> @@ -213,23 +206,23 @@ - Do... - - User CSS + 利用者の CSS *:not([role="img"]) { font-family: Verdana, sans-serif !important; } - Working example: + 動作例: - Two colored / stacked star Icon Font used as an indicator + 2色を重ねた星のアイコンフォント
<span class="icon-stacked"> <span class="icon icon-star-bg grey"></span> <span class="icon icon-star-half yellow"></span> </span>
<span class="icon-stacked" role="img" aria-label="Favorite star half filled"> <span class="icon icon-star-bg grey" role="img" aria-hidden="true"></span> <span class="icon icon-star-half yellow" role="img" aria-hidden="true"></span> @@ -213,23 +206,23 @@ - Do... -
- Two colored / stacked star Icon Font used as an indicator + 2色を重ねた星のアイコンフォント
In this example an email icon is in a link with no visible text. It does not disappear if a user overrides font family. The icon font is identified by assistive technology as a "link image" and the name "Email" (keyboard or mouse).
この例では、メールのアイコンがリンク内にあり、テキストは表示されていない。利用者がフォントファミリーを上書きしても消えない。アイコンフォントは、支援技術によって(キーボード又はマウス操作時に)"リンクされた画像" 及び "電子メール" として識別される。
/* default class for fonts-face with icons */ .icon { font-family: 'IconFontRoleImg' !important; } @@ -239,37 +232,37 @@ Author CSS HTML - - Instead of... - + - 次ではなく... - <a href="email.html"> <span class="icon icon-email"></span> </a> - - Do... - + - 次とする... - <a href="email.html"> <span class="icon icon-email" role="img" aria-label="Email"></span> </a> - User CSS + 利用者の CSS *:not([role="img"]) { font-family: Verdana, sans-serif !important; } - Working example: + 動作例: - Email Icon Font in a link WITHOUT visible text + 表示テキストのない、リンク内のメールアイコンフォント
<a href="email.html"> <span class="icon icon-email"></span> </a>
<a href="email.html"> <span class="icon icon-email" role="img" aria-label="Email"></span> </a>
- Email Icon Font in a link WITHOUT visible text + 表示テキストのない、リンク内のメールアイコンフォント
This example already has a visible text label in the link to be used as an accessible name, the mail and chevron font icons must stay visible when the font family is changed. This can be done by ensuring the icons are contained in their own element and the attribute aria-hidden="true" is used so the font icons will be ignored by assistive technologies.
aria-hidden="true"
この例では、アクセシブルな名前 (accessible name)として使用するために、リンクにテキストラベルが既に表示されている。フォントファミリーが変更されても、メールとシェブロンのフォントアイコンは表示されていなければならない。これは、アイコンがそれぞれの要素に含まれ、かつ、支援技術によってフォントアイコンが無視されるように属性 aria-hidden="true" が使用されることで実現できる。
/* default class for fonts-face with icons */ .icon { font-family: 'IconFontRoleImg' !important; } @@ -279,7 +272,7 @@ Author CSS HTML - - Instead of... - + - 次ではなく... - <style> .icon-double-link:before { content: "\e93e"; } .icon-double-link:after { content: "\e993"; } @@ -288,7 +281,7 @@ - Instead of... - <a href="email.html" class="icon-double-link">Email</a> - - Do... - + - 次とする... - <style> .icon-email:before { content: "\e93e"; } .icon-chevron:before { content: "\e993"; } @@ -303,13 +296,13 @@ - Do... - - User CSS + 利用者の CSS *:not([role="img"]) { font-family: Verdana, sans-serif !important; } - Working example: + 動作例: - Multiple Icon Fonts as part of another sematic element WITH visible text + 表示テキストのあるセマンティック要素の一部としての複数のアイコンフォント
<style> .icon-double-link:before { content: "\e93e"; } .icon-double-link:after { content: "\e993"; } @@ -288,7 +281,7 @@ - Instead of... - <a href="email.html" class="icon-double-link">Email</a>
<style> .icon-email:before { content: "\e93e"; } .icon-chevron:before { content: "\e993"; } @@ -303,13 +296,13 @@ - Do... -
- Multiple Icon Fonts as part of another sematic element WITH visible text + 表示テキストのあるセマンティック要素の一部としての複数のアイコンフォント
For each font icon check that:
それぞれのフォントアイコンに対して以下をチェックする:
Please share your ideas, suggestions, or comments via e-mail to the publicly-archived list public-agwg-comments@w3.org or via GitHub
あなたのアイデア、提案、又はコメントを、Google フォーム 又は GitHub で共有してください。
この文書は、2025 年 5 月 21 日付けの Techniques for WCAG 2.2 を、ウェブアクセシビリティ基盤委員会 (WAIC) の翻訳ワーキンググループが翻訳して公開しているものです。この文書の正式版は、W3C のサイトにある英語版です。正確な内容については、W3C が公開している原文 (英語) をご確認ください。この翻訳文書は作業進行中です。また、あくまで参考情報であり、翻訳上の誤りが含まれていることがあります。 +
この翻訳文書の利用条件については、WAICが提供する翻訳文書のライセンスをご覧ください。