|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 13 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
939 bytes
|
| Line | |
|---|
| 1 | # jsx-a11y/click-events-have-key-events
|
|---|
| 2 |
|
|---|
| 3 | 💼 This rule is enabled in the following configs: ☑️ `recommended`, 🔒 `strict`.
|
|---|
| 4 |
|
|---|
| 5 | <!-- end auto-generated rule header -->
|
|---|
| 6 |
|
|---|
| 7 | Enforce `onClick` is accompanied by at least one of the following: `onKeyUp`, `onKeyDown`, `onKeyPress`. Coding for the keyboard is important for users with physical disabilities who cannot use a mouse, AT compatibility, and screen reader users. This does not apply for interactive or hidden elements.
|
|---|
| 8 |
|
|---|
| 9 | ## Rule details
|
|---|
| 10 |
|
|---|
| 11 | This rule takes no arguments.
|
|---|
| 12 |
|
|---|
| 13 | ### Succeed
|
|---|
| 14 | ```jsx
|
|---|
| 15 | <div onClick={() => {}} onKeyDown={this.handleKeyDown} />
|
|---|
| 16 | <div onClick={() => {}} onKeyUp={this.handleKeyUp} />
|
|---|
| 17 | <div onClick={() => {}} onKeyPress={this.handleKeyPress} />
|
|---|
| 18 | <button onClick={() => {}} />
|
|---|
| 19 | <div onClick{() => {}} aria-hidden="true" />
|
|---|
| 20 | ```
|
|---|
| 21 |
|
|---|
| 22 | ### Fail
|
|---|
| 23 | ```jsx
|
|---|
| 24 | <div onClick={() => {}} />
|
|---|
| 25 | ```
|
|---|
| 26 |
|
|---|
| 27 | ## Accessibility guidelines
|
|---|
| 28 | - [WCAG 2.1.1](https://www.w3.org/WAI/WCAG21/Understanding/keyboard)
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.