rfd icon indicating copy to clipboard operation
rfd copied to clipboard

#128 fix

Open JustFrederik opened this issue 2 years ago • 6 comments

#128 fix

JustFrederik avatar Aug 01 '23 21:08 JustFrederik

That's a cool idea, but I'm pretty sure the supplied code does not work, the future will resolve immediately after click event and return None. And as far as I know there is no way to do this in HTML5 (would love to be proven wrong tho)

This could be possible with Chrome specific File System Access API, but that's a more complex to implement, and I'm not sure if it's worth implementing if it can not replace HTML code any time soon if ever (file system access is a controversial spec).

PolyMeilex avatar Aug 02 '23 18:08 PolyMeilex

@PolyMeilex sorry i havent checked the ouput and you are right the event triggers as soon as it is pressed, but i dont know why. i tried out the events with plain html and it works like it is supposed to. <input type="file" onclick="console.log('clicked')" onchange="console.log('change')" multiple>. The onclick event triggers as soon as it is pressed and the onchange request triggers when the window is closed. Im not sure why it isnt working

JustFrederik avatar Aug 02 '23 19:08 JustFrederik

@PolyMeilex i moved the eventlistener after the html is attached so the event wont be triggered immediately. Now it will only be triggered when a file is selected. I will look into it if there is an event that would be better suited than onchange.

JustFrederik avatar Aug 02 '23 19:08 JustFrederik

Even if you fix that, what's your plan for handling dialog cancelation? It does not trigger onChange as far as I remember

PolyMeilex avatar Aug 02 '23 19:08 PolyMeilex

@PolyMeilex chrome and safari focus the last focued element on close. Im looking into it how it could be deteted in firefox. alternativly it could be an option that it auto closes when a file is submitted and auto opens, but still display the popup as a fallback in case it is cancled.

JustFrederik avatar Aug 02 '23 20:08 JustFrederik

This could be possible with Chrome specific File System Access API, but that's a more complex to implement, and I'm not sure if it's worth implementing if it can not replace HTML code any time soon if ever (file system access is a controversial spec).

This doesn't appear to be Chrome specific. Can you share why it's controversial?

frewsxcv avatar Nov 29 '23 01:11 frewsxcv