File tree Expand file tree Collapse file tree 1 file changed +7
-10
lines changed
packages/react-interactions/events/src/dom/shared Expand file tree Collapse file tree 1 file changed +7
-10
lines changed Original file line number Diff line number Diff line change @@ -71,16 +71,13 @@ export function hasModifierKey(event: ReactDOMResponderEvent): boolean {
71
71
) ;
72
72
}
73
73
74
- // Keyboards, Assitive Technologies, and element.click() all produce "virtual"
75
- // clicks that do not include coordinates and "detail" is always 0 (where
76
- // pointer clicks are > 0).
74
+ // Keyboards, Assitive Technologies, and element.click() all produce a "virtual"
75
+ // click event. This is a method of inferring such clicks. Every browser except
76
+ // IE 11 only sets a zero value of "detail" for click events that are "virtual".
77
+ // However, IE 11 uses a zero value for all click events. For IE 11 we rely on
78
+ // the quirk that it produces click events that are of type PointerEvent, and
79
+ // where only the "virtual" click lacks a pointerType field.
77
80
export function isVirtualClick ( event : ReactDOMResponderEvent ) : boolean {
78
81
const nativeEvent : any = event . nativeEvent ;
79
- return (
80
- nativeEvent . detail === 0 &&
81
- nativeEvent . screenX === 0 &&
82
- nativeEvent . screenY === 0 &&
83
- nativeEvent . clientX === 0 &&
84
- nativeEvent . clientY === 0
85
- ) ;
82
+ return nativeEvent . detail === 0 && ! nativeEvent . pointerType ;
86
83
}
You can’t perform that action at this time.
0 commit comments