-
Notifications
You must be signed in to change notification settings - Fork 34
Description
use-file-picker is creating an invisible input element and attaching it to the DOM under the hood. It does that in order to reliably trigger the file picker UI in all browsers (Safari needs this #34). The problem is that in our openFileDialog.ts helper, we're only clearing this input from the DOM on a successful file selection.
If user opens the file selector, and then doesn't select anything, the dom element is gonna stay there indefinately. It is not a huge issue but it should be fixed.
In order to do that, we can add an 'cancel' event listener which I've tested and it works reliably on chrome and safari, both on desktop and mobile. We were trying to implement something like this a few years ago (#58) but it didn't work back then. Now seems like the browser support is ready to implement such feature.
This will also allow us to finally return a promise from the openFilePicker funciton!
