ロールは対象が何であるかを定義します
要素がタブ、アラート、ダイアログのいずれであるかを支援技術に伝えます。
「ロールは対象が何であるかを定義します」はCoddyKit上の無料Web Accessibility Academyレッスンです。 これはレッスン2/4です。 下記で完全なレッスンを無料で読むことができます。その後、ブラウザ内の組み込みコードエディタと24時間対応のAIチューターでハンズオン演習できます。 これはWeb Accessibility Academy学習パスの一部であり、ウェブとCoddyKitアプリ全体で進捗が同期されます。 Web Accessibility Academyコースには全4レッスンが含まれています。
このレッスンの一部はまだ翻訳されておらず、英語で表示されています。
A Role Is an Identity
A role tells assistive tech the kind of thing an element is: a button, a tab, an alert, a dialog. It answers what is this?
Native Elements Have Roles Already
Most HTML tags carry an implicit role built in. A nav is a navigation, an h1 is a heading, a button is a button.
<nav>...</nav>
<!-- implicit role: navigation -->The role Attribute
When no native tag fits, you set the role attribute by hand to give a generic element a recognized identity.
<div role="alert">Saved!</div>Widget Roles
Widget roles describe interactive things you sometimes build by hand: tab, slider, switch, menuitem, and treeitem.
Landmark Roles
Landmark roles map the page into regions like banner, main, and navigation so users can jump straight to a section.
Document Structure Roles
Structure roles describe static content: heading, list, listitem, and figure. They label the shape of your information.
One Role Per Element
An element gets one role. You cannot make something a button and a link at once, so pick the identity that matches its real job.
Roles Imply Requirements
Choosing a role is a contract. role=tab means you owe it a tablist parent, keyboard support, and a linked tabpanel.
<div role="tab" aria-selected="true">Profile</div>Do Not Override Good Semantics
Never put a role on an element that already has the right one. A redundant role on a real button just adds noise and risk.
<button role="button">Save</button>
<!-- the role is pointless here -->role=presentation Erases Meaning
role=presentation strips an element of its semantics. Useful for a layout table, dangerous on anything users need to understand.
Roles Are the Foundation
Get the role right first. States and properties only make sense once the element has a clear identity to attach them to.
Quick Check
You wrap a custom popup that interrupts the user in a div. Which role fits?
Recap: Roles First
You learned a role names what an element is. Prefer native implicit roles, add one explicit role only when needed, and honor its contract.
よくある質問
「ロールは対象が何であるかを定義します」レッスンは無料ですか?
はい。「ロールは対象が何であるかを定義します」の完全なテキストはこのウェブで無料で読めます。インタラクティブに演習し(組み込みコードエディタと24時間対応のAIチューター)、Web Accessibility Academyコースの残りをアンロックするには、CoddyKit PROにアップグレードしてください。 Web Accessibility Academyコースには全4レッスンが含まれています。
「ロールは対象が何であるかを定義します」で何を学びますか?
要素がタブ、アラート、ダイアログのいずれであるかを支援技術に伝えます。 ブラウザで直接実行するハンズオンコードでWeb Accessibility Academyを演習し、24時間対応のAIチューターがレッスンを進める中での質問に答えます。
Web Accessibility Academyを始めるのに経験は必要ですか?
事前経験は必要ありません。CoddyKitのWeb Accessibility Academyは初級者から上級者向けに構成されているため、ここから始めるか最初から始めて、自分のペースで進むことができます。 これはレッスン2/4です。
「ロールは対象が何であるかを定義します」レッスンにはどのくらい時間がかかりますか?
ほとんどのCoddyKitレッスンは約5~10分かかります。各レッスンはコンパクトでインタラクティブなので、着実に進歩し、ウェブとアプリ全体で正確に前回の場所から再開できます。
このWeb Accessibility Academyレッスンでコードを書いて実行できますか?
はい。すべてのWeb Accessibility Academyレッスンに組み込みコードエディタが含まれているため、ブラウザでリアルコードを書いて実行し、即座のAIフィードバックを取得できます。ローカル設定は不要です。