Skip to content

Commit 4cb5e97

Browse files
improve the rule docs so that it can be used as a migration guide
1 parent c8ca93d commit 4cb5e97

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

docs/rules/a11y-use-accessible-tooltip.md

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,33 @@
1-
# Recommends to use the `next` tooltip instead of the current stable one.
1+
# Recommends to use the new accessible tooltip instead of the deprecated one.
22

33
## Rule details
44

5-
This rule recommends using the tooltip that is imported from `@primer/react/next` instead of the main entrypoint. The components that are exported from `@primer/react/next` are recommended over the main entrypoint ones because `next` components are reviewed and remediated for accessibility issues.
5+
This rule suggests switching to the new accessible tooltip from @primer/react instead of the deprecated version. Deprecated props like wrap, noDelay, and align should also be removed.
6+
7+
Note that the new tooltip is intended for interactive elements only, such as buttons and links, whereas the deprecated tooltip could be applied to any element, though it lacks screen reader accessibility. As a result, the autofix for this rule will only work if the deprecated tooltip is on an interactive element. If it is applied to a non-interactive element, please consult your design team for [an alternative approach](https://primer.style/guides/accessibility/tooltip-alternatives).
8+
69
👎 Examples of **incorrect** code for this rule:
710

8-
```tsx
11+
```jsx
912
import {Tooltip} from '@primer/react/deprecated'
13+
14+
const App = () => (
15+
<Tooltip aria-label="This change cannot be undone" direction="w" wrap={true} noDelay={true} align="left">
16+
<Button onClick={onClick}>Delete</Button>
17+
</Tooltip>
18+
)
1019
```
1120

1221
👍 Examples of **correct** code for this rule:
1322

14-
```tsx
23+
```jsx
1524
import {Tooltip} from '@primer/react'
25+
26+
const App = () => (
27+
<Tooltip text="This change cannot be undone" direction="w">
28+
<Button onClick={onClick}>Delete</Button>
29+
</Tooltip>
30+
)
1631
```
1732

1833
## Icon buttons and tooltips

0 commit comments

Comments
 (0)