Whenever a new field is created, its type property is defaulted to "text" in both field state and field element. This makes field components like Textarea, Select and Radio abide by the type="text" validation rules, which is unexpected.
Expected behavior
Only Input component must have type="text" by default.
Why
Doing this allows to distinguish between field state's type and the type assigned to a field component. That means developers can assign their custom types to the field components to extend their validation logic, without spamming DOM elements within unsupported type attribute values.
How
Make propagation of the type prop to a field element explicit. Do not inherit from the state.
Assign necessary type prop on a field element explicitly using `enforceProps.
Environment
What
Current behavior
Whenever a new field is created, its
type
property is defaulted to "text" in both field state and field element. This makes field components like Textarea, Select and Radio abide by thetype="text"
validation rules, which is unexpected.Expected behavior
Only Input component must have
type="text"
by default.Why
Doing this allows to distinguish between field state's
type
and thetype
assigned to a field component. That means developers can assign their custom types to the field components to extend their validation logic, without spamming DOM elements within unsupportedtype
attribute values.How
type
prop to a field element explicit. Do not inherit from the state.type
prop on a field element explicitly using `enforceProps.