Skip to content

Commit

Permalink
fix(attach): fix drag counter & styles (#786)
Browse files Browse the repository at this point in the history
  • Loading branch information
reme3d2y committed Aug 9, 2021
1 parent bc8e865 commit b075725
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
6 changes: 6 additions & 0 deletions packages/dropzone/src/Component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ export const Dropzone: FC<DropzoneProps> = ({
}) => {
const [dragOver, setDragOver] = useState(false);

/**
* При ховере дочерних элементов срабатывает dragLeave, из-за чего пропадает оверлей
* https://stackoverflow.com/a/21002544
*/
const dragCounter = useRef(0);

const handleDragOver = useCallback(
Expand All @@ -83,6 +87,8 @@ export const Dropzone: FC<DropzoneProps> = ({
(event: React.DragEvent<HTMLElement>) => {
preventAndStopEvent(event);

dragCounter.current += 1;

setDragOver(true);

if (onDragEnter) {
Expand Down
1 change: 0 additions & 1 deletion packages/dropzone/src/index.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@

.dragOver .overlay {
opacity: 1;
pointer-events: all;
}

.error:after {
Expand Down

0 comments on commit b075725

Please sign in to comment.