File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change 1
- export default function shouldIntercept ( event : MouseEvent | KeyboardEvent ) : boolean {
1
+ // The actual event passed to this function could be a native JavaScript event
2
+ // or a React synthetic event, so we are picking just the keys needed here (that
3
+ // are present in both types).
4
+
5
+ export default function shouldIntercept (
6
+ event : Pick <
7
+ MouseEvent ,
8
+ 'altKey' | 'ctrlKey' | 'defaultPrevented' | 'target' | 'currentTarget' | 'metaKey' | 'shiftKey' | 'button'
9
+ > ,
10
+ ) : boolean {
2
11
const isLink = ( event . currentTarget as HTMLElement ) . tagName . toLowerCase ( ) === 'a'
12
+
3
13
return ! (
4
14
( event . target && ( event ?. target as HTMLElement ) . isContentEditable ) ||
5
15
event . defaultPrevented ||
6
- ( isLink && event . which > 1 ) ||
7
16
( isLink && event . altKey ) ||
8
17
( isLink && event . ctrlKey ) ||
9
18
( isLink && event . metaKey ) ||
You can’t perform that action at this time.
0 commit comments