File tree 1 file changed +14
-0
lines changed
packages/@react-aria/interactions/src
1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -38,6 +38,11 @@ export function useInteractOutside(props: InteractOutsideProps) {
38
38
let onPointerDown = ( e ) => {
39
39
if ( isValidEvent ( e , ref ) ) {
40
40
state . isPointerDown = true ;
41
+ // Due to browser inconsistencies, we prevent
42
+ // default on pointer down. FF will otherwise try to start text selection.
43
+ if ( e . button === 0 ) {
44
+ e . preventDefault ( ) ;
45
+ }
41
46
}
42
47
} ;
43
48
@@ -47,6 +52,9 @@ export function useInteractOutside(props: InteractOutsideProps) {
47
52
if ( state . isPointerDown && onInteractOutside && isValidEvent ( e , ref ) ) {
48
53
state . isPointerDown = false ;
49
54
onInteractOutside ( e ) ;
55
+ if ( e . button === 0 ) {
56
+ e . preventDefault ( ) ;
57
+ }
50
58
}
51
59
} ;
52
60
@@ -65,6 +73,9 @@ export function useInteractOutside(props: InteractOutsideProps) {
65
73
} else if ( state . isPointerDown && onInteractOutside && isValidEvent ( e , ref ) ) {
66
74
state . isPointerDown = false ;
67
75
onInteractOutside ( e ) ;
76
+ if ( e . button === 0 ) {
77
+ e . preventDefault ( ) ;
78
+ }
68
79
}
69
80
} ;
70
81
@@ -73,6 +84,9 @@ export function useInteractOutside(props: InteractOutsideProps) {
73
84
if ( onInteractOutside && state . isPointerDown && isValidEvent ( e , ref ) ) {
74
85
state . isPointerDown = false ;
75
86
onInteractOutside ( e ) ;
87
+ if ( e . button === 0 ) {
88
+ e . preventDefault ( ) ;
89
+ }
76
90
}
77
91
} ;
78
92
You can’t perform that action at this time.
0 commit comments