-
Notifications
You must be signed in to change notification settings - Fork 252
Labels are not connected to inputs in code examples #825
Comments
Hmm, I'm wondering if the responsibility of this should fall on the developer rather than the library. It's easy enough to do this: <label forHtml="user.name">User name</label>
<Control.text id="user.name" model="user.name" /> Or this: <label>
<span>User name:</span>
<Control.text model="user.name" />
</label> Both would solve the issue. What are your thoughts? |
Alternatively, it might be useful to have this automatically be done with a new component: <div className="field">
<Label model="user.name">User name:</Label>
<Control.text model="user.name" />
</div> ^ This will also allowed it to be used in React Native, where tapping the label would "focus" the text input, much like how it works on the web. How does this look? |
Thank you for attending to this issue so quickly! |
…vidkpiano#825" This reverts commit 7b89a37.
The Problem
When using a screenreader the labels for the inputs are not announced since they are not connected to the form-fields. This means that forms are very hard to fill in for screenreader-users. I.e. one tested input filled with a label "first name" was announced as "edit text". This is a problem because people do copy/paste code examples and might not correct this in their applications.
Steps to Reproduce
Try https://codepen.io/davidkpiano/pen/yJwmEa with a screenreader. Using Mac this can be tested with VoiceOver and Safari.
Expected Behavior
Labels should be connected to inputs via the for-attribute that connects to the id on the input (explicit label) or wrapped around the input (implicit label) More info on accessible forms
Actual Behavior
Labels are missing the for-attribute and are not connected to an id on the input
Reproducible Code Example
this CodePen template is a good example :)
The text was updated successfully, but these errors were encountered: