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
Allow non-string values to be used as ownValue #26
Conversation
@@ -105,7 +108,7 @@ export default function useFormState(initialState, options) { | |||
* returning the value of input from the current form state is illogical | |||
*/ | |||
if (isCheckbox || isRadio) { | |||
return ownValue; | |||
return toString(ownValue); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Per spec:
the user agent must set the value of the element to the value of the value content attribute, if there is one, or the empty string otherwise
Therefore, if ownValue
isn't specified by the user, it should return an empty string. Previously, it was returning undefined
. This should not result in any breaking changes.
a8ab950
to
fcc3414
Compare
* allow non-string values to be used as ownValue * always stringify input value of checkbox and radio * add test * cleanup * update README.md * remove eslint-disable
Fixes #14