react-dropzone / react-dropzone

Simple HTML5 drag-drop zone with React.js.

Home Page:https://react-dropzone.js.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`onFileDialogCancel` doesn't fire on Firefox on Mac

florantara opened this issue · comments

Do you want to request a feature or report a bug?

  • I found a bug
  • I want to propose a feature

What is the current behavior?
onFileDialogCancel doesn't fire on Firefox on Mac

If the current behavior is a bug, please provide the steps to reproduce.

  1. Open this codepen on FF on Mac: https://codepen.io/florantara/pen/1645ab3e5a88cad0b35fc5a5cc045750?editors=1111
  2. Click the "Add img" button
  3. Click "Cancel" on the file dialog

It should log to the console but it doesn't.

What is the expected behavior?
It should fire the event and log to the console.

Please mention other relevant information such as the browser version, Operating System and react-dropzone version.

  • version 11.2.4
  • macOS Catalina
  • Firefox 82.0.3

Hmm ... I definitely see the cb called, but it's not called when you'd expect. It looks like it's called only when you focus out and back on the window.

I think this is due to the hacky way we handle this dialog cancel. Because we expect the app window to be out of focus when the dialog is shown, but it seems like Firefox works differently.

Not sure how we could fix this without adding some other hacks. I'm open to suggestions.

@florantara would you like to make a PR to address this? I don't have enough time on my hands to do it.

@rolandjitsu I don't have a lot of time at the moment either, but I'll look into it when I do

@florantara any progress on this? Is this still relevant?

Still have this issue

commented

This issue has been automatically marked as stale because it has not had recent activity in the past 60 days. It will be closed if no further activity occurs. If the problem persists please comment here to bump your issue. Thank You - React Dropzone Maintaners

Related to #1079. And I'm not sure we can fix this in any way. There's some promising APIs being worked on to allow file system access and part of that also handling cancelation events.

But as I see it today, the onFileDialogCancel cb is pretty useless for files beyond a few MB. If the file is large, the timeout we have set to check if files were selected will trigger too early and give false positive.

So I'm inclined to deprecate/remove it (maybe just have a onFileDialogOpen/Close which can work) and start using the new file system APIs which are supported by very few browsers (Chrome and Opera I think).

Closed by 3ad4f00. This is the best I could do for now.