You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: docs/rules/mouse-events-have-key-events.md
+28-2
Original file line number
Diff line number
Diff line change
@@ -6,9 +6,35 @@
6
6
7
7
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.
8
8
9
-
## Rule details
9
+
## Rule options
10
+
11
+
By default, this rule checks that `onmouseover` is paired with `onfocus` and that `onmouseout` is paired with `onblur`. This rule takes an optional argument to specify other handlers to check for "hover in" and/or "hover out" events:
12
+
13
+
```json
14
+
{
15
+
"rules": {
16
+
"jsx-a11y/mouse-events-have-key-events": [
17
+
"error",
18
+
{
19
+
"hoverInHandlers": [
20
+
"onMouseOver",
21
+
"onMouseEnter",
22
+
"onPointerOver",
23
+
"onPointerEnter"
24
+
],
25
+
"hoverOutHandlers": [
26
+
"onMouseOut",
27
+
"onMouseLeave",
28
+
"onPointerOut",
29
+
"onPointerLeave"
30
+
]
31
+
}
32
+
]
33
+
}
34
+
}
35
+
```
10
36
11
-
This rule takes no arguments.
37
+
Note that while `onmouseover` and `onmouseout` are checked by default if no arguments are passed in, those are *not* included by default if you *do* provide an argument, so remember to explicitly include them if you want to check them.
0 commit comments