Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#128 fix #129

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

#128 fix #129

wants to merge 3 commits into from

Conversation

JustFrederik
Copy link

#128 fix

@PolyMeilex
Copy link
Owner

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).

@JustFrederik
Copy link
Author

@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
Copy link
Author

@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.

@PolyMeilex
Copy link
Owner

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

@JustFrederik
Copy link
Author

JustFrederik commented Aug 2, 2023

@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.

@frewsxcv
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants