Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

3 роки тому
12345678910111213141516171819202122232425
  1. # mouse-events-have-key-events
  2. Enforce onmouseover/onmouseout are accompanied by onfocus/onblur. Coding for the keyboard is important for users with physical disabilities who cannot use a mouse, AT compatibility, and screenreader users.
  3. ## Rule details
  4. This rule takes no arguments.
  5. ### Succeed
  6. ```jsx
  7. <div onMouseOver={ () => void 0 } onFocus={ () => void 0 } />
  8. <div onMouseOut={ () => void 0 } onBlur={ () => void 0 } />
  9. <div onMouseOver={ () => void 0 } onFocus={ () => void 0 } {...otherProps} />
  10. <div onMouseOut={ () => void 0 } onBlur={ () => void 0 } {...otherProps} />
  11. ```
  12. ### Fail
  13. In example 3 and 4 below, even if otherProps contains onBlur and/or onFocus, this rule will still fail. Props should be passed down explicitly for rule to pass.
  14. ```jsx
  15. <div onMouseOver={ () => void 0 } />
  16. <div onMouseOut={ () => void 0 } />
  17. <div onMouseOver={ () => void 0 } {...otherProps} />
  18. <div onMouseOut={ () => void 0 } {...otherProps} />
  19. ```