tldr; I need an element to register drag and drop pointer events, but pass click and other pointer events to elements behind it.
I am building a drag and drop photo upload feature in react using react-dropzone
. I want the dropzone
to be over the whole page, so if you drag a file onto any part of the page, you can drop it to upload the image. The dropzone
is transparent when no file is dragged over it, so I need clicks to register with elements behind it.
To accomplish this, I gave the dropzone component the following style:
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
pointer-events: none;
However, pointer-events: none;
causes the dropzone
to not recognize the necessary drag and drop events. Is there any way to recognize these specific pointer events, while passing others (like click) to elements behind the dropzone
?