Indicate required fields without label #3220
-
Beta Was this translation helpful? Give feedback.
Replies: 6 comments 5 replies
-
Generally speaking we advise labels on input fields for accessibility and usability reasons. If tells a user what the field is and its purpose, it also gives us space to indicate required fields. We don't rely on placeholders either. There are very few exceptions to this rule. Detailed here https://paste.twilio.design/components/input#accessibility Now, sometimes where we might have a collection of fields that are repeated, that might share a label, we might show one label above each column. Each input field is still labelled, it's just hidden. Usually when that happens we tend to see that a column is required information and so the required indicator can be placed in the label above the column, as they are all the same field type. This might be slightly different here. To repeat what I think I understand: We have an object which has a set of properties on the right, and we're mapping incoming data to that object shape. That object, for it to be valid, has a set of properties that are required to be filled by the incoming data Is that a good summary? |
Beta Was this translation helpful? Give feedback.
-
hey @SiTaggart had a similar use case i wanted to get your opinion on: i'm starting to take over some designs that were started last year using evergreen that have to do with alerting configuration. the original designs have a bunch of input fields without labels (attached), but i know paste doesn't recommend using an input without a label in a lot of scenarios. i started thinking about two different versions of this - one without a label and one with a label (also attached). |
Beta Was this translation helpful? Give feedback.
-
Adding more context! @serifluous created this alternative for inline label-less inputs that I think make a lot of sense for the more complex, visual-picker-y examples that come up: |
Beta Was this translation helpful? Give feedback.
-
Hi @simsemma Technically, yes, every form field should have a visible label. It's not necessarily a Paste thing either, it's part of meeting the basic requirements for Level A WCAG conformance, covered in part, but not fully by Success criteria 1.3.1 Information and relationships There is one except in there that I outlined above:
So you can omit labels where multiple fields share the same label, but there still has to a clear, visible label that describes the field. The other part of that design, which also isn't necessarily a Paste thing, is that the original and label less versions try to construct an English sentence out of parts of text and inputs. This won't localize well, and should be avoided. We have a section on the docsite about this https://paste.twilio.design/components/input#labels-and-help-text Hope that helps |
Beta Was this translation helpful? Give feedback.
-
@SiTaggart Thanks for the clarification - sounds like from a Paste component perspective, we'll still need an option for the component to hide the label to satisfy the use case you mentioned of multiple form fields sharing the same label. We could certainly just delete or remove the label in those cases, but also might be nice to have it as a toggle-able option or variant in figma. Also, more for my education since I'm not an accessibility expert, but I was looking through the W3 site on hiding labels and it seemed like that was an acceptable thing from an accessibility perspective if the label is provided in code for use cases where hiding a label is preferred? |
Beta Was this translation helpful? Give feedback.
-
@SiTaggart this is super helpful - thanks for providing such a thorough explanation on this, really appreciate it! |
Beta Was this translation helpful? Give feedback.
Yeah that certainly looks pretty aligned to what I was thinking.
Labels and obvious optional vs required fields. I like the idea of only showing the required fields up front, and adding optional fields afterwards