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
Upload input is not being cleared after files are uploaded when used on LiveComponent #1427
Comments
Hi @hubertlepicki - in the future, please use the provided issue template when creating new issues, thanks! I can confirm the same problem exists in Firefox and Safari, too :)
|
For the future reference, from the thread:
|
So I confirm that if I alter the config to have But I am not super certain if this behaviour is correct either. Yes, if liveupload-.6.mp4Note: I am not displaying "Pending uploads" in my code so it kind of makes more sense there. I have one file input, where I expect user to select a file (or files), then have the usual web experience on seeing that the input shows files are selected, and then they hit Upload. I could add "Pending uploads" but that's not on our designs and would have to go through someone to approve the UI change... but generally I think it's a custom feature to use "Pending uploads" and maybe we should be doing what the plain old HTML is doing when submitting form, by default. |
I'm also noticing that
|
Another note regarding this issue - when in this state (input is empty but still shows filename), selecting the same file again fails silently (state does not change). In order to select the file again without reloading the page, the user has two workarounds:
|
@hubertlepicki I believe this is fixed on master. Can you try it out and let me know? Thanks! |
* Reset live_file_input value when empty, closes #1427 * Fix cancelled uploads preventing form submit
If you try LiveUpload demo by @mcrumm here https://github.com/mcrumm/live_upload_example you will see two different behaviours on the "Basic Demo" and "Component Demo".
On the "Basic Demo", whenever a file upload finishes, the input field is cleared of the filename. This is consistent with the docs, which state that when you consume the uploaded files their entries will be removed. And it works as advertised if you use LiveUpload with LiveView directly.
When you go to "Component Demo" you will see, however, that the file upload input is not being cleared after file is uploaded. The file name stays visible. I am using Chrome 90, but probably this is present in other browsers too. See the video showing the issue:
liveupload-.5.mp4
ElixirForum thread for more info:
https://elixirforum.com/t/reset-live-file-input-after-file-has-been-uploaded/39154
The text was updated successfully, but these errors were encountered: