eslint-plugin-primer-react 6.2.0-rc.58af654 → 7.0.0-rc.0d4a60c
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -1
- package/README.md +1 -1
- package/docs/rules/a11y-use-accessible-tooltip.md +47 -0
- package/package-lock.json +1426 -855
- package/package.json +3 -3
- package/src/configs/recommended.js +1 -1
- package/src/index.js +1 -1
- package/src/rules/__tests__/a11y-tooltip-interactive-trigger.test.js +16 -0
- package/src/rules/__tests__/a11y-use-accessible-tooltip.test.js +59 -0
- package/src/rules/a11y-tooltip-interactive-trigger.js +9 -3
- package/src/rules/a11y-use-accessible-tooltip.js +148 -0
- package/docs/rules/a11y-use-next-tooltip.md +0 -33
- package/src/rules/__tests__/a11y-use-next-tooltip.test.js +0 -61
- package/src/rules/a11y-use-next-tooltip.js +0 -128
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
# eslint-plugin-primer-react
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## 7.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- [#270](https://github.com/primer/eslint-plugin-primer-react/pull/270) [`17814a2`](https://github.com/primer/eslint-plugin-primer-react/commit/17814a2d77d752b6675e51124fe3c18671837a10) Thanks [@broccolinisoup](https://github.com/broccolinisoup)! - Update a11y-use-next-tooltip to be a11y-use-accessible-tooltip and make the changes accordingly
|
|
4
8
|
|
|
5
9
|
### Minor Changes
|
|
6
10
|
|
|
@@ -8,6 +12,10 @@
|
|
|
8
12
|
|
|
9
13
|
- [#258](https://github.com/primer/eslint-plugin-primer-react/pull/258) [`83f29f3`](https://github.com/primer/eslint-plugin-primer-react/commit/83f29f339999b9c21d95167bcc2680c1797cbab6) Thanks [@keithamus](https://github.com/keithamus)! - Add enforce-css-module-identifier-casing rule
|
|
10
14
|
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- [#314](https://github.com/primer/eslint-plugin-primer-react/pull/314) [`63ef9fd`](https://github.com/primer/eslint-plugin-primer-react/commit/63ef9fdf02a9c4b80528644a96fd81e366bce187) Thanks [@khiga8](https://github.com/khiga8)! - fix: Link to should be allowed to have tooltip
|
|
18
|
+
|
|
11
19
|
## 6.1.6
|
|
12
20
|
|
|
13
21
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -39,4 +39,4 @@ ESLint rules for Primer React
|
|
|
39
39
|
- [a11y-explicit-heading](https://github.com/primer/eslint-plugin-primer-react/blob/main/docs/rules/a11y-explicit-heading.md)
|
|
40
40
|
- [a11y-link-in-text-block](https://github.com/primer/eslint-plugin-primer-react/blob/main/docs/rules/a11y-link-in-text-block.md)
|
|
41
41
|
- [a11y-remove-disable-tooltip](https://github.com/primer/eslint-plugin-primer-react/blob/main/docs/rules/a11y-remove-disable-tooltip.md)
|
|
42
|
-
- [a11y-use-
|
|
42
|
+
- [a11y-use-accessible-tooltip](https://github.com/primer/eslint-plugin-primer-react/blob/main/docs/rules/a11y-use-accessible-tooltip.md)
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# Recommends to use the new accessible tooltip instead of the deprecated one.
|
|
2
|
+
|
|
3
|
+
## Rule details
|
|
4
|
+
|
|
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
|
+
|
|
9
|
+
👎 Examples of **incorrect** code for this rule:
|
|
10
|
+
|
|
11
|
+
```jsx
|
|
12
|
+
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
|
+
)
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
👍 Examples of **correct** code for this rule:
|
|
22
|
+
|
|
23
|
+
```jsx
|
|
24
|
+
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
|
+
)
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Icon buttons and tooltips
|
|
34
|
+
|
|
35
|
+
Even though the below code is perfectly valid, since icon buttons now come with tooltips by default, it is not required to explicitly use the Tooltip component on icon buttons.
|
|
36
|
+
|
|
37
|
+
```jsx
|
|
38
|
+
import {IconButton, Tooltip} from '@primer/react'
|
|
39
|
+
|
|
40
|
+
function ExampleComponent() {
|
|
41
|
+
return (
|
|
42
|
+
<Tooltip text="Search" direction="e">
|
|
43
|
+
<IconButton icon={SearchIcon} aria-label="Search" />
|
|
44
|
+
</Tooltip>
|
|
45
|
+
)
|
|
46
|
+
}
|
|
47
|
+
```
|