Skip to content

Tooltip

What component has

Keyboard support

Keyboard support
KeyFunction
EscCloses the tooltip.

Focus behavior

  1. For Hint, the popper is not focusable.
  2. In the case of Tooltip, the popper becomes focusable if it contains any focusable elements.
  3. With DescriptionTooltip, the popper is always focusable and automatically receives focus when opened.

Hint attributes

The list below describes attributes that Hint component has.

Hint attributes
AttributeElementUsage
aria-hiddenpopperHint popper is hidden from assistive technologies.
aria-labeltriggerThe applied trigger text matches the text in the popper.

Tooltip roles and attributes

The list below describes roles and attributes that Tooltip component has.

Roles and attributes
RoleAttributeElementUsage
tooltipdivIt's a contextual text bubble that displays a description for an element that appears on pointer hover or keyboard focus.
aria-describedbytriggerAllows assistive technologies to announce a trigger description by popper content. If you need to set it on another element, checkout the accessibility example.
aria-live="polite"Implicit on divUsed to keep component accessible with browsers and screen readers that doesn't support aria-describedby . Assistive technologies will announce popper content when it's opened or changed.
aria-live="assertive"Implicit on div (only for tooltip with warning theme)Same to aria-live="polite" .

DescriptionTooltip roles and attributes

The list below describes roles and attributes that DescriptionTooltip component has.

Roles and attributes
RoleAttributeElementUsage
tooltipdivIt's a contextual text bubble that displays a description for an element that appears on pointer hover or keyboard focus.
aria-haspopuptriggerHelps assistive technologies to indicate that trigger has corresponding dropdown.
aria-expandedtriggerAdded when popper is visible. Helps assistive technologies to indicate that opened dropdown.

Considerations for developers

  • When open, tooltips shouldn't block a user from performing any task on the page.
  • Tooltips shouldn't be revealed until a short time has passed (~1-5 seconds).
  • Whenever possible, use descriptive text on your form fields that does need to be activated by a focus or hover event. Tooltips can be problematic for some assistive technologies (AT) devices.

Find live examples in the A11y style guide.

Resources

A11y style guide describes core principles for the accessible inputs and textarea.

Other recommendations

See more accessibility recommendations in the common Accessibility guide.

Released under the MIT License.

Released under the MIT License.