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

[file] strict validation not compatible with react-dropzone #1604

Closed
csantos-nydig opened this issue Nov 12, 2024 · 2 comments · Fixed by #1606
Closed

[file] strict validation not compatible with react-dropzone #1604

csantos-nydig opened this issue Nov 12, 2024 · 2 comments · Fixed by #1606
Assignees

Comments

@csantos-nydig
Copy link

I'm mostly curious why this validation exists:

case 'file':
if (value !== '') {
throw new DOMException(
'Input elements of type "file" may only programmatically set the value to empty string.',
DOMExceptionNameEnum.invalidStateError
);
}
break;

And if it can be removed or updated?

Context

I'm using react-dropzone and they have this line https://github.com/react-dropzone/react-dropzone/blob/c36ab5bd8b8fd74e2074290d80e3ecb93d26b014/src/index.js#L807-L808
which triggers and error in vitest + happy-dom

Plain JS example

https://codesandbox.io/p/sandbox/silly-kowalevski-qjrmt6

const fileInput = document.getElementById("my-file");
fileInput.value = null;

doesn't throw errors in any browser

Originally posted by @csantos-nydig in #1495

@csantos-nydig csantos-nydig changed the title I'm mostly curious why this validation exists: [file] strict validation not compatible with react-dropzone Nov 12, 2024
@capricorn86 capricorn86 self-assigned this Nov 12, 2024
capricorn86 added a commit that referenced this issue Nov 12, 2024
@capricorn86
Copy link
Owner

Related to #1576

@capricorn86
Copy link
Owner

Thank you for reporting @csantos-nydig! 🙂

I believe it should be fixed now.

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