Form Instructions

Back to Overview
00:00 --> 00:07
solution for a lot of use cases. All right, let's look at form instructions. So instructions are

00:07 --> 00:13
basically additional information to know how to fill out a form because sometimes it's not

00:13 --> 00:19
straightforward. Like if you have a date input field, what is the text format that you have to

00:19 --> 00:26
put in there? Do you put the day first as, you know, people usually do here in Europe? Or do

00:26 --> 00:32
you put the month as the first thing, like people in the United States are often doing.

00:34 --> 00:41
You need to specify that, and that's why you need instructions. And there are a couple of ways to do

00:41 --> 00:50
that. And the easiest way to make sure that you have instructions are overall instructions. Things

00:50 --> 00:56
like all fields marked required must be complete. And you put that at the top of the form. And then

00:56 --> 01:09
you have a good information of what the user needs to do. The same goes with dates or passwords or

01:09 --> 01:13
something like that. You know, you can just put that all up front and you're good to go.

01:14 --> 01:20
But often you don't want to do that or you want to additionally have inline instructions.

01:21 --> 01:28
And inline instructions, you have seen those are basically things like month, month, year, year, year, year.

01:30 --> 01:32
Like this expiry date example.

01:33 --> 01:35
And you can do that in different ways.

01:36 --> 01:41
So in this case, and this is my preferred way because I think it's super easy and super straightforward.

01:41 --> 01:50
You just put the instruction into the label and just say expiration date, month, year, year, year, year.

01:51 --> 01:57
And then this will be read when the screen reader user goes into the form field.

01:58 --> 02:00
Most easy thing to do.

02:03 --> 02:06
But sometimes you don't want to do that or you can't do that.

02:06 --> 02:16
And most of the time that's because of design considerations or design restrictions.

02:17 --> 02:20
So designers can make this harder.

02:20 --> 02:24
So you will see this in practice and usually done wrong.

02:25 --> 02:28
So this is the example.

02:28 --> 02:32
You have an additional information underneath the label.

02:33 --> 02:40
And then you have your underneath the field and you have your label here, in this case, on the left.

02:41 --> 02:49
And so this means that if I go into the field, it will only read expiration date, but not if I use ARIA labeled by.

02:49 --> 02:52
This is, again, one of the ARIA things.

02:52 --> 02:53
I just mention it.

02:53 --> 02:54
Don't think too much about it.

02:55 --> 02:57
We will explain it more in detail next week.

02:59 --> 03:11
So what I can do with ARIA labeled by is basically rope in this label here with one ID and then the description here with the other ID.

03:11 --> 03:18
And basically using ARIA labeled by, I can connect them and then they will both be read.

03:18 --> 03:21
First, this will be read, then this will be read.

03:21 --> 03:27
And it will have the same result as the first example.

03:27 --> 03:39
So I want to go into the inspector and then we can go into elements here and then go on here.

03:40 --> 03:47
And under LE or sometimes accessibility, you can find the accessible name.

03:47 --> 03:52
The accessible name is basically what the name of the form field is.

03:53 --> 03:54
And you see that this is from the input.

03:55 --> 04:06
This is not from the label. The label is before that. If I click on that, it doesn't want me to click it.

04:06 --> 04:12
Oh yeah, now I clicked it, so it does not have an accessible name, because that's not the thing.

04:12 --> 04:15
It's just a container for the accessible name.

04:16 --> 04:29
And then if I click on the input here, it says the accessible name because they are connected through the for and ID normally as we talked about.

04:29 --> 04:38
And then this aria-labeled-by, if I take that, inspecting that, we basically see the same thing.

04:38 --> 04:41
Expiration date, colon, and then mmyyyy.

04:42 --> 04:50
And that's because this aria-labelledby basically points at this first and then this code second.

04:50 --> 04:51
Pretty neat.

04:52 --> 04:56
But also, like, you see how much more code that is.

04:56 --> 04:57
Like, you have to have two IDs.

04:57 --> 05:07
They have to be unique on the page so you don't get, you know, accidental, like, wrong associations.

05:07 --> 05:08
So they should be unique.

05:09 --> 05:15
And then you need the aria-labeledby and you need the two ids and you need to smush them together properly.

05:15 --> 05:23
So it's already like a lot of more things to do.

05:23 --> 05:29
You can also use aria-describedby and that's basically using the label normally.

05:30 --> 05:35
And then you use aria-describedby here.

05:36 --> 05:44
And that will basically also associate this text, but as secondary information to the form field.

05:47 --> 05:51
Now you might say, oh, what about placeholder text?

05:51 --> 06:06
So we see this often in forms like here that you have like email and then instead of an empty field, you have like joe at example.com.

06:06 --> 06:10
And if you click into it, it stays and then you can type your stuff.

06:12 --> 06:17
And what we also often see is that the label is not even there.

06:17 --> 06:21
So you don't, you miss completely out of what this is once you start typing.

06:22 --> 06:29
And that's actually a WCAG failure because you can't have an unlabeled field.

06:29 --> 06:36
And once you start typing, even like a space, you don't know what's going on if you don't have a separate visible label.

06:36 --> 06:39
So you always want to have a label.

06:39 --> 06:42
Placeholders are not a replacement for labels.

06:44 --> 06:49
Sometimes these examples, so the placeholders are just examples of data that can in there.

06:50 --> 06:51
Sometimes that can be okay.

06:52 --> 06:56
But in general, it is like super confusing for a lot of people.

06:56 --> 07:09
So I have seen people who clicked into like a field like this and first try to press delete to delete the email address because they don't realize that it is just a placeholder.

07:11 --> 07:14
And that's always enlightened to see.

07:14 --> 07:21
You go to even people who know what they're doing with computers and stuff,

07:21 --> 07:25
and they click in it and by default they press delete

07:25 --> 07:30
because they just assume it's text in there, so you don't want to do that.

07:31 --> 07:36
And if you have longer forms, users might even have the impression

07:36 --> 07:40
that they have already filled out sections of the form that they don't have

07:40 --> 07:46
or that they don't need to fill that out or that this is like default stuff and they can just leave

07:46 --> 07:54
it in so they might not go in there and adapt that to their own needs so in general placeholders are

07:54 --> 08:03
bad don't use placeholders that's the moral of the story and one minor thing there is that

08:03 --> 08:14
placeholders are generally not meeting WCAG 2.1 success criteria. So that's another thing that,

08:15 --> 08:21
for contrast, I should say, that's like another ding against them. Like you need to like put

08:21 --> 08:28
placeholder color and make sure that the opacity is reset because some browsers use that for the

08:28 --> 08:38
the effect and make them visible and and yeah that's additional you know additional stuff that

08:38 --> 08:44
you need to do that is in the grand scheme of things totally unneeded because you don't need

08:44 --> 08:51
placeholders never use placeholders placeholders are bad and i can say this again placeholders

08:51 --> 08:55
they are bad don't use them yeah super important

08:55 --> 08:55
and