Skip to content

Commit 7e8eeaa

Browse files
committed
Set setIsDragging(true) from handleDragOver() conditionally to fix pointer-events
1 parent 68e349d commit 7e8eeaa

File tree

2 files changed

+7
-11
lines changed

2 files changed

+7
-11
lines changed

src/components/FileInputField/FileInputField.jsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -89,15 +89,16 @@ export const FileInputField = React.forwardRef((props, ref) => {
8989
};
9090

9191
const handleDragOver = (event) => {
92+
if (!isDragging) {
93+
setIsDragging(true);
94+
}
9295
event.preventDefault();
9396
};
9497

95-
const handleDragEnter = () => {
96-
setIsDragging(true);
97-
};
98-
9998
const handleDragLeave = () => {
100-
setIsDragging(false);
99+
if (isDragging) {
100+
setIsDragging(false);
101+
}
101102
};
102103

103104
useEffect(() => {
@@ -124,8 +125,6 @@ export const FileInputField = React.forwardRef((props, ref) => {
124125
getRootValidationStateClassName(validationState, styles),
125126
)}
126127
id={id && `${id}__root`}
127-
onClick={handleClick}
128-
onDragEnter={!disabled && isDragAndDropSupported ? handleDragEnter : undefined}
129128
onDragLeave={!disabled && isDragAndDropSupported ? handleDragLeave : undefined}
130129
onDragOver={!disabled && isDragAndDropSupported ? handleDragOver : undefined}
131130
onDrop={!disabled && isDragAndDropSupported ? handleDrop : undefined}
@@ -157,6 +156,7 @@ export const FileInputField = React.forwardRef((props, ref) => {
157156
<button
158157
className={styles.dropZone}
159158
disabled={resolveContextOrProp(inputGroupContext && inputGroupContext.disabled, disabled)}
159+
onClick={handleClick}
160160
type="button"
161161
>
162162
<Text lines={1}>

src/components/FileInputField/FileInputField.module.scss

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,6 @@
1616
// Foundation
1717
.root {
1818
@include foundation.root();
19-
20-
* {
21-
pointer-events: none; // 2
22-
}
2319
}
2420

2521
.label {

0 commit comments

Comments
 (0)