web 3d图形渲染器
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
798 B

  1. # click-events-have-key-events
  2. 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. This does not apply for interactive or hidden elements.
  3. ## Rule details
  4. This rule takes no arguments.
  5. ### Succeed
  6. ```jsx
  7. <div onClick={() => {}} onKeyDown={this.handleKeyDown} />
  8. <div onClick={() => {}} onKeyUp={this.handleKeyUp} />
  9. <div onClick={() => {}} onKeyPress={this.handleKeyPress} />
  10. <button onClick={() => {}} />
  11. <div onClick{() => {}} aria-hidden="true" />
  12. ```
  13. ### Fail
  14. ```jsx
  15. <div onClick={() => {}} />
  16. ```
  17. ## Accessibility guidelines
  18. - [WCAG 2.1.1](https://www.w3.org/WAI/WCAG21/Understanding/keyboard)