Closed dm-de closed 1 month ago
The problem is that doing
input.files = null;
doesn't error but also doesn't reset the files.
This either should be a documentation issue (we should specify that input.files = null
doesn't actually empty the input or we could actually make this behaviour work.
And btw if you want you can also reset the files like this
<button onclick={() => files = new DataTransfer().files}>Reset</button>
we could actually make this behaviour work.
That would diverge from the default behavior defined in the spec. Not sure if it matters that much in this case, though.
Some examples in the docs on how to use DataTransfer
would be nice, I could also potentially help with that.
That would diverge from the default behavior defined in the spec.
Yeah that's why i didn't open a PR for it...i feel like that would teach wrong JS and it feels wrong. Let me label this as documentation and open a PR for it and we can discuss there is we want the "kinda wrong" behaviour.
open a PR for it and we can discuss there is we want the "kinda wrong" behaviour.
Oh actually scratch this...the docs we have right now is just mention this in the breaking changes. I'll keep the issue open for when we write the docs for svelte 5 tho.
https://svelte.dev/docs/svelte/v5-migration-guide#Breaking-changes-in-runes-mode
bind:files values can only be null, undefined or FileList
As I understand, this is wrong
It's technically correct, according to the spec null
just does nothing, though.
There previously was more documentation on how to use bind:files
on the preview site docs, ideally those would be restored somewhere. (@dummdidumm?)
Describe the bug
DOC: https://svelte-5-preview.vercel.app/docs/breaking-changes#other-breaking-changes-bind-files-values-can-only-be-null-undefined-or-filelist
But... nothing happen visually if I set files to null Internally, here is
elem.value = ''
required, or somethingReproduction
Here is not working example: LINK
Here is working example with workaround: LINK
Logs
No response
System Info
Severity
annoyance