implicitly required form fields visual
For some form fields:
- Those representing boolean value (
Toggle,CheckboxField) - Those representing value from list (
SelectField,Radio)
The semantics of required are different then for fields such as TextField. When TextField is left empty, it means the user did not specify value. When one of the above mentioned special fields is left untouched, it still carries a meaning (e.g. false).
The above mentioned special fields are therefore always required as it is impossible not to fill them. Accordingly, they should always be styled as required fields even when they do not have the required attribute.
The required attribute on boolean fields means "must be set to true" which is different from its meaning when used with for example a TextField. When the required attribute is used in this sense, it must be communicated by other means, (e.g. by adding (required) to the label or such).
Note that HTML <select multiple> can be left with no selected value, but RUI does not implement this.
In a video call we did not find agreement on the concept of implicitly required.
The solution we agreed on is to separate required HTML attribute from presentation details. There should be another prop that will render field in the "required" visual.
I'm unsure if the new prop (something like renderRequired or such) should be available on all Form Elements or only on Toggle, CheckboxField, SelectField, Radio.
As I see it, I'd go with renderAsRequired on check fields (Toggle, CheckboxField, Radio) and on the SelectField.
Should both required and renderAsRequired be present, required would take precedence as it also adds the required HTML attribute.