Skip to content

Latest commit

 

History

History
47 lines (33 loc) · 1.02 KB

tooltip-not-recommended.md

File metadata and controls

47 lines (33 loc) · 1.02 KB

Accessibility: Prefer text content or aria over a tooltip for these components MenuItem, SpinButton (@microsoft/fluentui-jsx-a11y/tooltip-not-recommended)

💼 This rule is enabled in the ✅ recommended config.

All interactive elements must have an accessible name.

Tooltip not recommended for these components: MenuItem, SpinButton, etc.

Prefer text content or aria over a tooltip for these components.

https://www.w3.org/TR/html-aria/

Rule Details

This rule aims to prevent the usage of Tooltip.

Examples of incorrect code for this rule:

<Tooltip content="menu item" relationship="label">
    <MenuItem />
</Tooltip>
<Tooltip content="menu item" relationship="label">
    <SpinButton />
</Tooltip>

Examples of correct code for this rule:

<div>
<label id="my-label">More option<label>
<MenuItem aria-labelledby="my-label"/>
</div>
<div>
<label id="my-label">More option<label>
<SpinButton aria-labelledby="my-label"/>
</div>