-
-
Notifications
You must be signed in to change notification settings - Fork 211
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
Input type checkbox indeterminate state not working #1439
Comments
This is the JSDOM behavior but not the default behavior. You can try to make a minimal file example like this one: <!DOCTYPE html>
<html><body>
<input type="checkbox" />
<script type="text/javascript">
document.querySelector('input').indeterminate = true
</script>
</body></html> And test it with chrome or firefox, with chrome it constantly make it true when clicked, and with firefox reloading the page will make it false or true changing the value on each reload. So if your input is checked and indeterminate it should when clicked be unchecked, |
There's still a problem with the happy-dom implementation, as triggering a click event on the element will not change the indeterminate state at all, but is should be passed to false. |
Also I can see the actual implementation sets an attribute indeterminate on the input element but it should not as indeterminate is not meant to be an input attribute. |
will propose a PR about this in few days |
…indeterminate is not an attribute)
PR on the way :) |
…aves correctly (#1475) * fix: [#1439] Fix setting indeterminate sets an attribute (indeterminate is not an attribute) * fix: [#1439] Set indeterminate to false on click event --------- Co-authored-by: David Ortner <[email protected]>
Should be solved by merged #1475 @capricorn86 , @MarvinKubus |
Thank you again @malko! 🌟 |
Describe the bug
A checkbox with the indeterminate state being true should go to false when clicked, but this is not happening with happy-dom, it does with jsdom.
To Reproduce
Minimal example: https://stackblitz.com/edit/vitest-dev-vitest-rzc6un?file=test%2Fbasic.test.ts
Switch the happy-dom to jsdom there to see the test succeed.
Expected behavior
When clicking a checkbox element, I expect the indeterminate state to switch to false.
The text was updated successfully, but these errors were encountered: