本指南總結了可訪問工具提示的最佳實踐,從領先的可訪問性專家繪製。
工具提示為UI元素提供了簡短的文本提示,並出現在懸停或焦點上。 簡潔的定義:一種非模式覆蓋層,提供有關UI控件的補充,描述性文本。 至關重要的是,可訪問的工具提示包含 描述性文本,而沒有交互式元素。 如果需要互動,請改用對話框。
>>工具提示可實現兩個主要目的:
>圖標標籤:用於簡短標籤(一個或兩個單詞),使用
<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
中。
<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"
>在鼠標上/焦點上打開,關閉鼠標out/blur。 > 使用
>屬性(它具有重大可訪問性問題)。aria-haspopup
限制和替代方案role="tooltip"
由於缺乏懸停和焦點,進一步閱讀<dialog></dialog>
role="status"
<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>
WCAG 2.1時(Sarah Higley)
工具提示以上是工具提示最佳實踐的詳細內容。更多資訊請關注PHP中文網其他相關文章!