eslint-plugin-primer-react 7.0.0-rc.903d3f3 → 7.0.0-rc.ffaa602
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 +6 -0
- package/docs/rules/a11y-no-title-usage.md +40 -0
- package/package-lock.json +1254 -121
- package/package.json +3 -3
- package/src/configs/recommended.js +1 -0
- package/src/index.js +1 -0
- package/src/rules/__tests__/a11y-no-title-usage.test.js +27 -0
- package/src/rules/__tests__/a11y-tooltip-interactive-trigger.test.js +16 -0
- package/src/rules/a11y-no-title-usage.js +37 -0
- package/src/rules/a11y-tooltip-interactive-trigger.js +9 -3
package/CHANGELOG.md
CHANGED
|
@@ -6,12 +6,18 @@
|
|
|
6
6
|
|
|
7
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
|
|
8
8
|
|
|
9
|
+
- [#316](https://github.com/primer/eslint-plugin-primer-react/pull/316) [`40016c8`](https://github.com/primer/eslint-plugin-primer-react/commit/40016c8db99b4045ed7474cead0b48eed05f5f64) Thanks [@TylerJDev](https://github.com/TylerJDev)! - Add `a11y-no-title-usage` that warns against using `title` in some components
|
|
10
|
+
|
|
9
11
|
### Minor Changes
|
|
10
12
|
|
|
11
13
|
- [#266](https://github.com/primer/eslint-plugin-primer-react/pull/266) [`90134bc`](https://github.com/primer/eslint-plugin-primer-react/commit/90134bcee073c424e81c53e69632e1518798af93) Thanks [@keithamus](https://github.com/keithamus)! - Add enforce-css-module-default-import rule
|
|
12
14
|
|
|
13
15
|
- [#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
|
|
14
16
|
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- [#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
|
|
20
|
+
|
|
15
21
|
## 6.1.6
|
|
16
22
|
|
|
17
23
|
### Patch Changes
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
## Rule Details
|
|
2
|
+
|
|
3
|
+
This rule aims to prevent the use of the `title` attribute with some components from `@primer/react`. The `title` attribute is not keyboard accessible, which results in accessibility issues. Instead, we should utilize alternatives that are accessible.
|
|
4
|
+
|
|
5
|
+
👎 Examples of **incorrect** code for this rule
|
|
6
|
+
|
|
7
|
+
```jsx
|
|
8
|
+
import {RelativeTime} from '@primer/react'
|
|
9
|
+
|
|
10
|
+
const App = () => <RelativeTime date={new Date('2020-01-01T00:00:00Z')} noTitle={false} />
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
👍 Examples of **correct** code for this rule:
|
|
14
|
+
|
|
15
|
+
```jsx
|
|
16
|
+
import {RelativeTime} from '@primer/react'
|
|
17
|
+
|
|
18
|
+
const App = () => <RelativeTime date={new Date('2020-01-01T00:00:00Z')} />
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
The noTitle attribute is true by default, so it can be omitted.
|
|
22
|
+
|
|
23
|
+
## With alternative tooltip
|
|
24
|
+
|
|
25
|
+
If you want to still utilize a tooltip in a similar way to how the `title` attribute works, you can use the [Primer `Tooltip`](https://primer.style/components/tooltip/react/beta). If you use the `Tooltip` component, you must use it with an interactive element, such as with a button or a link.
|
|
26
|
+
|
|
27
|
+
```jsx
|
|
28
|
+
import {RelativeTime, Tooltip} from '@primer/react'
|
|
29
|
+
|
|
30
|
+
const App = () => {
|
|
31
|
+
const date = new Date('2020-01-01T00:00:00Z')
|
|
32
|
+
return (
|
|
33
|
+
<Tooltip text={date.toString()}>
|
|
34
|
+
<Link href="#">
|
|
35
|
+
<RelativeTime date={date} noTitle={true} />
|
|
36
|
+
</Link>
|
|
37
|
+
</Tooltip>
|
|
38
|
+
)
|
|
39
|
+
}
|
|
40
|
+
```
|