Closed aesopwolf closed 6 years ago
@track0x1 I'm running into a problem with the reset-values example. Would you mind taking a look at it? Just run yarn examples
, open up http://localhost:8080/reset-values/index.html
and click the "Reset" button -- I can't figure out why the checkbox disappears. I've been trying to debug this for 2 days.
I'm thinking about using "defaultChecked" in Checkbox.js
but will need to wait for react v15.6.2 since there's a bug at the moment
@aesopwolf Looks like its caused by the behavior of the browsers <form>
API
type
reset
: The button resets all the controls to their initial values.
The problem is that in a field like a checkbox, you have to actually change the value of the checked
attribute to check/uncheck it, which removes our initial state that would otherwise be used by reset()
provided via form API.
Easiest solution is to avoid using reset
button type and switch it to something like type="button"
.
Wow... I have no words. Thank you so much. I was going crazy.
It's been a while since I've touched this. I'm just going to merge it in to the beta branch as is and open up more PR's as need be.
I'm going to push changes to this PR over the next few days / week in preparation for releasing v1.