Document Structure Roles

Back to Overview
00:00 --> 00:25
The next ones are document structure roles. And now we would say like, doesn't the landmark role structure documents? Yeah, that's true. But these are like more detailed. So document structure roles are basically for mostly for text structure. And there are a lot of them. As a matter of fact, most of them you will never use at all.

00:25 --> 00:46
So I have them listed here. This is page one of two. So you never want to use application, you never want to use article because there's an article element, there's a block quote, HTML element, caption cells, you know, these are all pretty much reflected in HTML.

00:46 --> 01:09
And one reason that they are in ARIA 1.2 is because some smart people, I guess, have looked at HTML and said like, oh, we need to pick all of these document structure, text structure things and put them into ARIA as well.

01:09 --> 01:22
So if we are using a technology that is not HTML like PDF, we can say, oh, for your image, please specify an IMG role or for your list, specify a list role.

01:23 --> 01:25
Technically, you should never need to use those.

01:26 --> 01:37
The one thing that I sometimes use or sometimes find useful is role group, where you can just group things together.

01:37 --> 01:46
And it's not a landmark, but it can have a name and so have a little bit of more structure, but it's totally not needed.

01:48 --> 01:50
Second page, there are others.

01:52 --> 01:59
And the two that are interesting here are none and presentation. These are actually the same thing.

02:00 --> 02:07
So if you define a role none, then this will take the role that it had and removes it. So

02:07 --> 02:18
for example, if you have, let's say, what's a good example? I don't really have a good example.

02:18 --> 02:24
Let's say you have a table and you're using it for layout.

02:24 --> 02:25
You should never do that.

02:25 --> 02:26
Stop doing it.

02:26 --> 02:28
If you do it, don't do it.

02:29 --> 02:33
Then you can use role none or role presentation.

02:33 --> 02:35
Role presentation is just older.

02:35 --> 02:45
And put that on the table and it will remove the semantics of the table so that the screen reader user is not getting read that this is a table.

02:45 --> 02:48
Although it isn't because you're using it for design.

02:48 --> 02:54
You should never do that, but, you know, sometimes you do stuff there.

02:55 --> 03:04
And some of these, like, have parent-child relationships.

03:05 --> 03:14
So, for example, table, a row needs to be in the table and stuff like that.

03:14 --> 03:20
list, what did we have here? List items need to be inside of a list. And inside of a list,

03:20 --> 03:25
there can only be list items. So there are constraints there. In practice, if you use

03:25 --> 03:34
HTML correctly, you don't need to think about that. These roles are there. If you cannot

03:34 --> 03:42
otherwise edit the HTML, let's say you get your HTML from a third party site, or you,

03:42 --> 03:49
you know, it's like older code and you're just, you want to do the HTML right, but you don't have

03:49 --> 03:56
the time. So you quickly jerry-rig something together, then this is something you can do.

03:58 --> 04:04
And as I have said, most document structure roles have direct HTML equivalence.

04:05 --> 04:10
And we call that implicit roles, like the image has an implicit role of IMG,

04:11 --> 04:13
And a table has an implicit role of table.

04:14 --> 04:15
It's pretty straightforward.

04:17 --> 04:18
So, yeah.

04:18 --> 04:23
And so, generally, you don't need to use roles at all if you write good HTML.

04:26 --> 04:27
Checking that off.

04:27 --> 04:27
you