-
Notifications
You must be signed in to change notification settings - Fork 126
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Renamed and modified button-role-space to click-events-have-key-event…
…s to be more consistent with the rule in the the eslint-plugin-jsx-a11y library
- Loading branch information
Erin Doyle
committed
Oct 13, 2018
1 parent
3e9e4b5
commit ce7f037
Showing
4 changed files
with
51 additions
and
55 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# click-events-have-key-events | ||
|
||
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 screenreader users. | ||
|
||
|
||
## options | ||
|
||
*This rule takes no options* | ||
|
||
## Passes | ||
|
||
```jsx harmony | ||
// passes when there is an `onClick` handler and there is an `onKey*` handler. | ||
<div onClick={fn} onKeyDown={this.handleKeyDown} /> | ||
<div onClick={fn} onKeyUp={this.handleKeyUp} /> | ||
<div onClick={fn} onKeyPress={this.handleKeyPress} /> | ||
|
||
// passes when the element is aria-hidden | ||
<div onClick={fn} aria-hidden="true"></div> | ||
``` | ||
|
||
## Fails | ||
|
||
```jsx harmony | ||
// fails when there is an `onClick` handler and no `onKey*` is present | ||
<div onClick={fn}></div> | ||
``` | ||
|
||
## See also | ||
|
||
- [This document](https://www.w3.org/WAI/GL/wiki/Making_actions_keyboard_accessible_by_using_keyboard_event_handlers_with_WAI-ARIA_controls) from w3.org |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters