このガイドは、アクセス可能なツールチップのベストプラクティスを要約しています。
ツールチップの理解のみののみの説明的なテキストが含まれており、インタラクティブな要素が含まれていません。 インタラクティブが必要な場合は、代わりにダイアログを使用します。
2つのツールチップタイプ
簡単なラベル(1つまたは2つの単語)の場合、aria-labelledby
<button aria-labelledby="notification-count notification-label"> <span id="notification-count">3</span> <span id="notification-label">Notifications</span> </button> <div role="tooltip" id="tooltip-label">Notifications</div>
aria-describedby
本質的なdoとnots
<button aria-describedby="tooltip-description"> <span style="display:none;">Notifications</span> <span aria-hidden="true">?</span> </button> <div role="tooltip" id="tooltip-description">View and manage notification settings</div>
またはを適切に使用します 現在の画面リーダーのサポートが制限されていても、
aria-labelledby
aria-describedby
コンテンツをホバリングするときにツールチップの解雇を防止します
role="tooltip"
(ツールチップは非相互作用)を使用します ツールチップ内に必須コンテンツを配置します。スクリーンリーダーは、関連するARIA属性を無視する場合があります
制限と代替案title
要素を検討してください。 しばしば「i」アイコンで示されているトググレットは、aria-haspopup
Toggletipsの詳細については、以下のリソースを参照してください
role="tooltip"
さらに読み取り
<dialog></dialog>
aria-label、aria-labelledby、およびaria-describedby(LéonieWatson)に関する短いメモrole="status" HTMLダイアログ要素(Chris Coyier)
<button aria-controls="toggletip-content"> <span aria-hidden="true">ⓘ</span> </button> <div id="toggletip-content" role="status" aria-live="assertive" style="display:none;">This clarifies whatever needs clarifying</div>
以上がツールチップベストプラクティスの詳細内容です。詳細については、PHP 中国語 Web サイトの他の関連記事を参照してください。