Loading content...
Loading content...
Comprehensive guide to creating accessible tooltips with proper ARIA patterns and keyboard support.
Users who zoom in often need to pan the screen. If the tooltip disappears when the mouse pointer moves (e.g., to scroll), they can't read the content.
Tooltips that vanish instantly require precise mouse movements. This is frustrating and sometimes impossible for users with tremors or motor impairments.
role="tooltip" on the tooltip element. Associate it with the trigger using aria-describedby on the trigger pointing to the tooltip's id. The tooltip should appear on both hover and focus. Use aria-live="polite" if the tooltip appears dynamically. Ensure the tooltip is keyboard accessible and doesn't block other content.Testing Guide
If the tooltip is slightly separated from the trigger, moving the mouse to the tooltip will close it.
Tooltip closes instantly, making it impossible to hover over the content.
<button onMouseLeave={() => setShow(false)}>
Trigger
</button>A small timeout allows users to traverse the gap between trigger and tooltip.
<button onMouseLeave={safeClose}>
Trigger
</button>
// safeClose waits 300ms before closingThe native `title` attribute is visually inconsistent and not keyboard accessible in many browsers.
Title attribute often won't appear on focus and can't be styled.
<button title="More info">
Help
</button>Custom tooltips give you full control over accessibility and styling.
<button aria-describedby="tip">
Help
</button>
<div id="tip" role="tooltip">More info</div>