All above combined

Back to Overview
00:00 --> 00:12
Hello and welcome to the Way Aria week. This is like super technical and this will be a little

00:12 --> 00:19
bit more like upfront talking about what the different concepts are and then in the live

00:19 --> 00:31
tutoring session, we are going to go and basically go into the details to look at different stuff and

00:31 --> 00:37
talk about it, because that makes much more sense than doing it in this, like, you know,

00:37 --> 00:45
with basically a wall between us. So that's the plan. Let's kick it off with talking about what

00:45 --> 00:53
is WAI-ARIA. It's one of the longer specifications from W3C and it stands for Web Accessibility

00:53 --> 01:00
Initiative Accessible Rich Internet Application. Now you might be wondering why does it have the

01:00 --> 01:08
WAI in front of it? Why isn't it just ARIA? And the reason is that there were like trademark issues

01:08 --> 01:11
or something like that, so they couldn't use just ARIA.

01:12 --> 01:18
So they added the way dash before it just to make sure that that works.

01:18 --> 01:25
So in general, we will just call it ARIA, and I will probably call it ARIA from now on.

01:26 --> 01:28
And what is ARIA?

01:28 --> 01:30
That's always the question, of course.

01:31 --> 01:35
Accessible Rich Internet Application doesn't mean they make you rich.

01:35 --> 01:39
as much as I would love that this was the case.

01:39 --> 01:45
It basically means that there are rich interactions with internet applications,

01:45 --> 01:48
with web applications that you can specify.

01:48 --> 01:55
So when you have more in-depth interactions with the user interface,

01:56 --> 02:01
then you can translate those states and properties and roles and names,

02:01 --> 02:06
I will talk about all of that, to assistive technology more efficiently.

02:10 --> 02:16
Yeah, so it makes the various elements of the user interface compatible with assistive

02:16 --> 02:22
technology. So you can basically be more precise than just using HTML. HTML works great and should

02:22 --> 02:32
always be your default, I will talk about that too, but it allows more nuance for assistive technology.

02:34 --> 02:41
Now there is a caveat though, and that is that WAI-ARIA is designed to align with the web

02:41 --> 02:50
interaction with Windows 98 accessibility APIs. Now I don't know if you noticed, but few people

02:50 --> 03:01
are using Windows 98 these days, mostly because it's 24 years old. And so that's a little bit of

03:01 --> 03:09
a problem. And the other problem is that this is not only accessibility APIs, but it's specifically

03:09 --> 03:18
screen reader accessibility APIs. So everything we're talking about is mainly, or was initially

03:18 --> 03:28
mainly aimed at screen reader users. And that is, of course, a little bit of a problem because

03:28 --> 03:35
the accessibility is so much broader than just screen reader users. So we have to keep that in

03:35 --> 03:43
mind. And that means that a lot of things are happening in there. I made a little diagram.

03:44 --> 03:55
So that shows basically how ARIA helps to make sure that there is a good input and output for assistive technology.

03:55 --> 03:59
So in the browser, we have HTML and CSS and JavaScript.

04:00 --> 04:04
HTML and CSS basically build the accessible object model.

04:04 --> 04:08
That's basically a representation of what's on the screen.

04:08 --> 04:12
So if something is hidden, gets removed from the accessible object model.

04:12 --> 04:19
If something is put in, put back in, it's added to the accessible object model and so on.

04:19 --> 04:26
And JavaScript interacts with the accessible object model, sometimes by changing CSS, sometimes by changing HTML.

04:28 --> 04:31
And the browser interprets all of that.

04:31 --> 04:36
And that is basically where ARIA comes in.

04:37 --> 04:44
Because you can in your HTML, or let's keep it just there.

04:44 --> 04:48
So the browser interprets that all, then hands it over to an accessibility API.

04:49 --> 04:55
And that accessibility API hands it over to assistive technology for interpretation, output, and input.

04:55 --> 04:59
And then it goes back to the accessibility API and back to the browser.

05:00 --> 05:09
Now where ARIA comes in is that you are basically inside of the Accessible Object Models, you

05:09 --> 05:15
are defining things for the Accessibility API specifically.

05:15 --> 05:21
Like you say, this is a button and then the HTML will interpret that as a button.

05:21 --> 05:27
It will be in the Accessible Object Model and that will be transferred to the Accessibility

05:27 --> 05:29
API.

05:29 --> 05:36
And so you have this like more control over what happens.

05:36 --> 05:40
So ARIA informs the assistive technology how to interpret content and UI.

05:40 --> 05:43
You can be like normative.

05:43 --> 05:47
You can say like, yeah, you have to read this as this.

05:47 --> 05:53
And that means that there is no meaningful error correction or anything like that.

05:53 --> 05:58
You basically tell ARIA that this is what you do and this is what you want.

05:58 --> 05:59
And then it does that.

06:01 --> 06:04
And ARIA can be used in many different technologies.

06:04 --> 06:13
So ARIA is not just for HTML and CSS, which will be what we're talking about today mostly.

06:13 --> 06:21
But it is also applicable to like EPUBs or mobile applications.

06:23 --> 06:31
whole like whatever you have user interfaces, you can use ARIA technology and sometimes ARIA directly

06:32 --> 06:41
to reveal what is going on there and basically specify more directly what's going on.

06:43 --> 06:49
So for the specification, we have a couple of different sections. It's a very, very

06:50 --> 06:56
complicated specification. I will not even click on the link because I think it's like

06:57 --> 07:02
a little bit too much and we will talk about all the aspects but I will like basically pick out

07:04 --> 07:09
smaller things that are interesting for you and that you can use. And the current

07:11 --> 07:18
version is ARIA 1.1 but everyone says like yeah there was a bit of a miss of how it worked out so

07:18 --> 07:27
So please look at ARIA 1.2, which is a W3C candidate recommendation draft since December 2021.

07:28 --> 07:30
So about a year and a bit.

07:31 --> 07:38
And it might get to a recommendation in April 2023.

07:39 --> 07:42
So that might happen.

07:42 --> 07:44
Let's cross our fingers and hope for the best.

07:46 --> 07:57
But yeah, so everything I talk about is already ARIA 1.2 because ARIA 1.1 had some things in it that just didn't work as well.

07:57 --> 07:58
And they have been corrected now.

07:59 --> 08:04
And all of the browsers and assistive technology, they all look at ARIA 1.2.

08:04 --> 08:08
So, you know, it doesn't make any sense to look at ARIA 1.1.

08:09 --> 08:10
And that's good.

08:10 --> 08:13
You know, it's good that we have this correction.

08:15 --> 08:32
Now, for ARIA, from an ARIA standpoint, you always have three distinct pieces of information that every interactive UI component needs.

08:33 --> 08:34
And that is what type it is.

08:35 --> 08:41
Is it a button? Is it a link? Is it a navigation? Is it a dialog? Something like that.

08:41 --> 08:46
and the name of that information, of that content.

08:47 --> 08:53
So if you have a button that closes, you know, the name of that button should be close.

08:53 --> 09:04
If you have a link that goes to the homepage of Chas, then it should be Chas homepage, the name of the link, stuff like that.

09:05 --> 09:07
So pretty straightforward, actually.

09:08 --> 09:11
And then there are different properties of content.

09:11 --> 09:21
And the properties are mainly there to point at different states and properties.

09:22 --> 09:30
And that means that you can say, for example, this button is in a pressed state or this link is the current link.

09:30 --> 09:35
Those are examples we will talk about a little bit really soon.

09:35 --> 09:41
So, yeah, so that's basically the properties can be and you can have multiple properties on one thing.

09:41 --> 09:55
So you could, for example, have, thinking of something that is good, a link that is, a button that is pressed.

09:56 --> 10:06
And also because the website is like getting more information, that button might also be busy.

10:06 --> 10:11
So it would say like button pressed busy, for example.

10:11 --> 10:19
so i have talked about the types of content and these are defined as roles so every user interface

10:19 --> 10:27
component and component is like very vast thing that they are using every user interface component

10:27 --> 10:36
has its role what it does what is the type of it and there are six roles defined and we go through

10:36 --> 10:43
all of them and we start with one but we won't do it linearly because that's that's like it's not

10:43 --> 10:50
not a good order of things so i will i will step you through but the first one is number one is the

10:50 --> 10:58
abstract roles definition uh yeah and this is the order as it is in the uh specification i wanted to

10:58 --> 11:07
keep that you know for you so you don't have like any needs to search around let's start with

11:07 --> 11:16
abstract roles so abstract roles are utility roles that are used in the background you don't need to

11:16 --> 11:24
know about them really ever i have never used them i don't know really what they do they are mostly for

11:24 --> 11:31
browser implementers screen readers to have something where they you know don't have to do

11:31 --> 11:40
everything for every role at once but that they can use to replicate and then like go from there

11:40 --> 11:47
so as i said as this says basically this is abstract and you don't need to know them

11:47 --> 11:57
There are a couple of those that you might recognize, like the landmark abstract role or the widget abstract role.

11:58 --> 12:07
So that's basically where other roles are going to have their foundation on.

12:07 --> 12:20
But as I said, like how they fit together, it's like for practical creating websites, testing websites, it doesn't matter at all.

12:20 --> 12:22
Like this is completely irrelevant stuff.

12:22 --> 12:23
So forget all of this.

12:24 --> 12:25
Okay, check.

12:26 --> 12:28
Let's go to the landmark roles next.

12:29 --> 12:37
Landmark roles are important because they basically give you an overview of the site.

12:37 --> 12:41
If you are a screen reader user, you can get a list of all the landmark roles.

12:43 --> 12:46
And these are the landmark roles that exist.

12:46 --> 12:50
It's only like a handful and a bit.

12:50 --> 12:56
So there's banner, complementary, content info, form, main, navigation, region, and search.

12:56 --> 13:01
And you would say like, huh, didn't we talk about those in page structure?

13:02 --> 13:04
Yes, we actually did.

13:04 --> 13:08
We did talk about the HTML equivalents.

13:08 --> 13:20
And this is like an important concept because you, in general, don't want to talk ARIA directly, as I have said.

13:20 --> 13:29
And a lot of things are actually built into HTML that are then reflected in ARIA.

13:30 --> 13:33
And let's look at the page structure stuff.

13:34 --> 13:41
So if you have a banner landmark role, you can just use the header element.

13:41 --> 13:49
And that is equivalent because the header already has built in the banner role.

13:49 --> 13:59
So the browser knows that this is what it has to give to the assistive technology, to the API.

13:59 --> 14:01
The same goes for the content info role.

14:02 --> 14:03
You can just use a footer.

14:05 --> 14:13
Main has a main element equivalent, and you can use those only once because that's how it's specified.

14:13 --> 14:17
It makes only sense to have one main content.

14:17 --> 14:20
If everything is a main content, nothing is a main content.

14:21 --> 14:29
And then we have complementary. Complementary is one that can be used as many times as you want.

14:29 --> 14:38
And you can use the HTML aside element to achieve the same semantics basically.

14:40 --> 14:46
And there are a couple more. Navigation is reflected in the nav element,

14:46 --> 14:57
So you can use an infinite number of nav elements, forms, you can use an unlimited number of those,

14:57 --> 15:02
then use the form element, search is a form with a role search. You can also use, technically,

15:02 --> 15:08
you can use other elements with the role search, but in general you have a search form, so just

15:08 --> 15:09
Just put it on the form.

15:10 --> 15:17
And then region with a section is every section is a region.

15:17 --> 15:25
And if you put an accessible name on it, for example, using ARIA label or ARIA labeled by, then it becomes a landmark.

15:25 --> 15:34
It's not a landmark technically if it's only just a section element because people started using sections for everything.

15:34 --> 15:47
And that's not a good thing because then, as I've said with the main, you then have landmarks everywhere and you can't pick out what really sticks out there.

15:48 --> 15:51
So these are the landmark roles, just these eight.

15:54 --> 16:01
And they have direct HTML equivalents that you should use.

16:02 --> 16:08
Check off. The next ones are document structure roles. And now we would say like,

16:09 --> 16:14
doesn't the landmark role structure documents? Yeah, that's true. But these are like more

16:14 --> 16:22
detailed. So document structure roles are basically for mostly for text structure. And there are a lot

16:22 --> 16:33
of them. As a matter of fact, most of them you will never use at all. So I have them listed here,

16:33 --> 16:39
this is page one of two. So you never want to use application, you never want to use article,

16:39 --> 16:45
because there's an article element, there's a blockquote HTML element, caption cells,

16:46 --> 16:55
you know, these are all pretty much reflected in HTML. And one reason that they are in ARIA 1.2

16:55 --> 17:03
is because some smart people, I guess, have looked at HTML and said like, oh, we need to pick

17:03 --> 17:14
all of these document structure, text structure things and put them into ARIA as well. So if we

17:14 --> 17:22
are using a technology that is not HTML like PDF, we can say, oh, for your image, please specify an

17:22 --> 17:29
IMG role or for your list, specify a list role. Technically, you should never need to use those.

17:30 --> 17:39
The one thing that I sometimes use or sometimes find useful is role group, where you can just

17:39 --> 17:46
group things together and it's not a landmark but it can have a name and so have a little bit

17:46 --> 17:57
of more structure but it's totally not needed. Second page there are others and the two that

17:57 --> 18:05
are interesting here are none and presentation. These are actually the same thing so if you

18:05 --> 18:13
define a role none then this will take the role that it had and removes it so for example if you

18:13 --> 18:22
have um let's say what's a good example uh uh i don't i don't really have a good example let's

18:22 --> 18:29
say you have um you have a table and you're using it for layout you should never do that stop doing

18:29 --> 18:38
it. If you do it, don't do it. Then you can use role none or role presentation. Role presentation

18:38 --> 18:45
is just older and put that on the table and it will remove the semantics of the table so that

18:45 --> 18:50
the screen reader user is not getting read that this is a table, although it isn't because you're

18:50 --> 18:58
using it for design. You should never do that, but sometimes you do stuff there.

18:58 --> 19:08
And some of these like have parent-child relationships.

19:08 --> 19:18
So for example, table, row needs to be in the table and stuff like that.

19:18 --> 19:19
List, what did we have here?

19:20 --> 19:22
List items need to be inside of a list.

19:23 --> 19:25
And inside of a list, there can only be list items.

19:25 --> 19:27
So there are constraints there.

19:27 --> 19:34
in practice if you use html correctly you don't need to think about that these

19:34 --> 19:43
roles are there if you cannot otherwise edit the html let's say you get your html from a third

19:43 --> 19:52
party site or you um you know it's like older code and you're just you you want to do the html

19:52 --> 19:59
write, but you don't have the time, so you quickly jerry-rig something together, then this is something you can do.

20:01 --> 20:07
And as I have said, most document structure roles have direct HTML equivalents.

20:09 --> 20:17
And we call that implicit roles, like the image has an implicit role of IMG, and the table has an implicit role of table.

20:17 --> 20:19
It's pretty straightforward.

20:21 --> 20:27
So, yeah, and so generally you don't need to use roles at all if you write good HTML.

20:29 --> 20:31
Checking that off.

20:32 --> 20:35
The next type of content is widget roles.

20:36 --> 20:40
And widget roles are basically more complicated components.

20:41 --> 20:46
And there are two types of widget roles, or two types of widgets, actually.

20:47 --> 20:51
One is composite widgets and the other one is standalone widgets.

20:52 --> 21:00
Composite widgets generally consist of multiple standalone widgets.

21:00 --> 21:05
So, for example, if you have a menu, you have menu items inside of that.

21:06 --> 21:09
And so the menu can't exist on its own.

21:09 --> 21:10
It has to have a menu bar in it.

21:11 --> 21:12
It has to have menu items in it.

21:12 --> 21:18
And just FYI, menu here means file menu, edit menu, view menu.

21:18 --> 21:22
It does not mean navigation like you have it on a normal website.

21:22 --> 21:24
You don't need to use any of these roles for that.

21:25 --> 21:32
Just use navigation, nav element, and then just a list inside of it and you're good.

21:32 --> 21:36
But these are really like more complicated widgets.

21:36 --> 21:42
It's like a combo box would be if you have a search and that has like recommendation underneath it.

21:43 --> 21:50
Grid is something like calendar where you can basically two dimensionally interact with the individual grid items.

21:53 --> 22:00
Yeah, and then there's radio group, which you already know from our radio group examples for forms.

22:00 --> 22:02
So this is also in here.

22:02 --> 22:07
You never need that because you just use HTML radio groups.

22:07 --> 22:11
And then there is tab list and tree and tree grid.

22:12 --> 22:30
Now, because this is depending on Windows 98 technology, one of the things that happens is that newer operating systems or different operating systems might not have concepts for some of the things.

22:30 --> 22:38
in these APIs. So this is especially true for tree and tree grid. On macOS or iOS,

22:39 --> 22:45
tree and tree grid basically do not exist at all. It's just not a concept that is in the language

22:45 --> 22:56
of these operating systems. So that means if you specify that using ARIA, it might not come out

22:56 --> 23:03
to the user as a useful information. And indeed, like the trees and tree grids, they are basically

23:03 --> 23:15
useless on non-Windows 98 type operating systems. I think modern Windows has tree grids occasionally,

23:15 --> 23:24
but it's for sure less of a concern as it was. There are many more standalone widgets,

23:24 --> 23:35
things like buttons, radio, progress bar, slider, tabs, tab panel, stuff like that.

23:35 --> 23:43
So these are standalone widgets that can be inside of composite widget, but they don't have to be.

23:43 --> 23:45
Some of them need to, some of them do not.

23:45 --> 23:53
For example, a button can exist outside of a composite widget, but a menu item cannot.

23:53 --> 24:03
Many widget items also have direct HTML equivalents. These implicit roles are, for example,

24:03 --> 24:10
a button has the implicit role of button, an input type radio has an implicit role of radio,

24:10 --> 24:18
and so on and so forth. So it's not that you have to know about those widget roles as much,

24:18 --> 24:29
as long as you keep using good HTML. I wonder if my plea for using good HTML crosses over. And that

24:29 --> 24:37
already checks off widget roles. I'm not going to go into detail here. Window roles are super short

24:37 --> 24:43
because there are only two and we can remember them really easily. One is the dialogue and the

24:43 --> 24:45
The other one is the alert dialog.

24:46 --> 24:55
And basically the only way they differentiate between themselves is that the alert dialog is basically in your face and gets read aloud immediately.

24:55 --> 24:58
And the dialog is just a window on the website.

24:59 --> 25:06
And we now have the dialog element in HTML that basically works as this dialog role.

25:07 --> 25:12
At the moment, I think it's good to know that this exists.

25:12 --> 25:18
But over time, this will be less useful knowledge for sure.

25:18 --> 25:20
And that's window roles.

25:20 --> 25:23
Pretty straightforward, right?

25:23 --> 25:29
Live region roles are part of the user interface that is announced to screen reader users.

25:29 --> 25:37
And this is a relative complex, like this could be a whole how to do live regions, could

25:37 --> 25:47
be a whole talk by itself. And actually, I did do a talk about that a year about a year ago.

25:48 --> 25:57
And I will make sure to link to the slides in the description for this. But it doesn't really,

25:58 --> 26:05
there's not a lot of value to go to go in there and, and describe all of the life regions

26:05 --> 26:13
in detail. What live regions do is that they basically you put stuff in there like you have

26:13 --> 26:20
a div or paragraph or whatever you have and it has a live region role like role

26:20 --> 26:28
status that would be the most common one and you put in with javascript you put in

26:28 --> 26:36
text. And that text would be read to the screen reader user without any modification, without any

26:36 --> 26:44
like navigation possibilities. Like that text is right directly moved to the screen reader user.

26:44 --> 26:49
And that's super useful for things like, oh, you've got a new chat message or things like

26:49 --> 26:56
the website has finally loaded, the JavaScript has finally loaded, stuff like that. You want to do

26:56 --> 27:05
that. There's also an alert role that gives you immediate feedback. So alert will interrupt the

27:05 --> 27:10
screen reader at that time. So I shouldn't use that. And then there's lock marquee and timer,

27:10 --> 27:19
which I have never used in practice. They have their use cases, but they are like,

27:20 --> 27:31
like rare and they also are like, some of them don't even like announce by default. You have to

27:31 --> 27:37
to set some settings there. So I think alert and status are the most important things here.

27:40 --> 27:45
And that brings us to the end of our regions. That was pretty straightforward.

27:47 --> 28:00
Naming user interface elements is super important for accessibility because, I mean, you have, it's great to know that there is a button there, but you also need to know what happens when you press that button, right?

28:00 --> 28:02
So that's why we need names.

28:02 --> 28:07
Save, close, all these good button names.

28:07 --> 28:08
And there are a couple of ways to do that.

28:08 --> 28:22
There are also descriptions, which are basically like the little brother or sister of the names, which is basically secondary information for the user interface elements.

28:22 --> 28:23
And we get to that.

28:26 --> 28:32
And it's important to know that ARIA is not the only way to set the name of an element.

28:33 --> 28:37
The name of the element can be determined by a variety of things.

28:37 --> 28:39
And I will not go into all of them.

28:39 --> 28:41
There's a whole other specification for that.

28:41 --> 28:46
If you want to read up on the ARIA name calculation, you can do that.

28:46 --> 28:47
But you should not.

28:47 --> 28:48
You should not.

28:52 --> 28:59
So if you have a button that is named save, then the button has the text save on it.

29:00 --> 29:03
And also the accessible name of the button is save.

29:03 --> 29:08
So, no aria to be seen here.

29:10 --> 29:16
But the accessible name can also come from other elements.

29:16 --> 29:27
For example, if you have two text nodes inside of the button or you have like a span in there or something like that, that all counts and will be combined to the name of the button.

29:27 --> 29:38
Or if you have an image of a disk inside of the button with the alternative text save, then the save will be used in the accessible name calculation.

29:39 --> 29:41
Look it up if you want to. Don't do it.

29:41 --> 29:47
Will be used as the name, as the accessible name of the button too.

29:48 --> 29:52
And then there's two ways to do it for using ARIA.

29:53 --> 30:01
And these you can use when you are in a situation where you can't easily change the text inside of the button.

30:02 --> 30:20
So, for example, if you have just an X or times sign inside of the button as the visual label and you want to name it close for screen reader users, then you can use the ARIA label close and this will work.

30:21 --> 30:26
And will be announced in the screen reader as close button.

30:27 --> 30:28
And that's it.

30:28 --> 30:32
Like there's no indication that there's something else inside of the button.

30:33 --> 30:38
And then you can also use aria-labeled by with two L's.

30:38 --> 30:38
That's important.

30:39 --> 30:43
And that basically references another element.

30:43 --> 30:51
So in this case, let's assume I have a lot of buttons that have a close label.

30:51 --> 30:58
and I only want to change it once, if I do, for example, an update or add a second language,

30:58 --> 31:04
then I can use a span. Actually, the element doesn't really matter here, but use id close

31:04 --> 31:11
label and say it's close and then button aria-labeled by a close label. And that basically

31:11 --> 31:19
references this id and takes the text inside of the span and put that as the aria-label.

31:19 --> 31:38
And so the accessible name of this button is also close. And yeah, there are good use cases for this. But it's not like, like you're doing this all the time. This is actually, especially this example is relatively rare.

31:40 --> 31:50
The analog goes for description. So in this case, we have a close name. The name is close.

31:50 --> 31:57
And there's an aria described by closed desk. And then a span with the id closed desk for closed

31:57 --> 32:03
description. It says back to start. So in this case, this would be announced as close button,

32:03 --> 32:09
back to start. So there's always a little bit like a pause there. And then at the end,

32:09 --> 32:17
there is the description and that can help you to give additional information to people using screen readers.

32:18 --> 32:23
There is a relatively new ARIA described attribute in ARIA 1.2.

32:25 --> 32:29
But yeah, the support is not super good.

32:29 --> 32:32
So I didn't put that on its own slide.

32:32 --> 32:39
Maybe in a couple of months or in a year or something like that, ARIA described is good enough.

32:39 --> 32:52
And then you can name regions. So in contrast to interactive elements, labels do not overwrite the content when used with regions.

32:52 --> 33:02
I think that's an important point that I didn't make super clear here. If we go back to here, this label completely replaces the X in here.

33:02 --> 33:05
There could be anything inside this button.

33:05 --> 33:06
It could be open.

33:06 --> 33:09
It could be, I don't know, hello.

33:09 --> 33:10
It could be anything.

33:11 --> 33:16
Screen reader users would only see the close label.

33:17 --> 33:21
So ARIA label in this instance overrides the content.

33:21 --> 33:29
If you're naming regions, that would be awfully inconvenient because we want to name the region

33:29 --> 33:33
and then you want to interact with individual things inside of that region.

33:34 --> 33:39
So in this case, we have a main navigation that is labeled.

33:40 --> 33:48
And this goes for all landmark roles and most of those grouping roles that I've shown.

33:52 --> 34:01
really it's not really depending on the type of role when it when this is like overwrite overwriting

34:01 --> 34:08
or not so this is a little bit harder to figure out but in general for landmarks this is the use

34:08 --> 34:15
case you have a nav aria label equals main and then you have content inside of that that's

34:15 --> 34:45
untouched by the ARIA label and then you have closing nav. And what this will be announced as main navigation. And that's basically it. So navigation because of the role and then main because that is the name of the region. And so you can use ARIA label, ARIA label by same way to label those regions pretty easily.

34:45 --> 34:56
If you don't label landmark regions, they will just show up as navigation and you don't have any specific labeling, which is fine.

34:57 --> 35:04
And you also don't need to write main navigation because navigation as the role is already read.

35:04 --> 35:05
So, you know, don't bother with it.

35:06 --> 35:08
States and properties.

35:08 --> 35:10
There are a lot of states and properties in ARIA.

35:10 --> 35:17
If we talk through all of them, we would be here until like, you know, in seven weeks we wouldn't be done.

35:18 --> 35:19
This is super complex.

35:19 --> 35:31
And the good thing is once you come across one, you can easily, relatively easily check in the specification if it meets your use case.

35:32 --> 35:35
So let's start with global states and properties.

35:35 --> 35:39
So these can be generally put on anything.

35:39 --> 35:44
and I want to highlight a few.

35:45 --> 35:49
ARIA-label, for example, ARIA-labeled-by, we already talked about those.

35:50 --> 35:53
ARIA-live makes everything, anything a live region.

35:54 --> 35:58
So if you have a span and you want to make it a live region,

35:58 --> 36:01
you can use the role, but you can also use ARIA-live.

36:02 --> 36:04
And there are a couple of others.

36:05 --> 36:09
ARIA role description defines what is read as the role.

36:10 --> 36:19
So you might have something that is, let's say, an article, and you use an article element.

36:20 --> 36:24
But in reality, you want it to be announced as product.

36:24 --> 36:28
Then you can use ARIA role description equals product.

36:28 --> 36:33
and it would not be announced as a new phone article.

36:34 --> 36:40
It would be announced as new phone product, which can help in certain situations.

36:40 --> 36:46
I think I've never really used it in a practical way.

36:47 --> 36:52
And then there's ARIA current, which basically means that you can say on a link,

36:53 --> 36:54
this is the link you're currently on.

36:54 --> 37:10
So if you're in navigation, you can use ARIA current, and then you can even use CSS to query that ARIA current true or page status, and then apply your CSS that way.

37:10 --> 37:11
It's pretty neat.

37:14 --> 37:16
And we have the widget attributes.

37:16 --> 37:23
Those are like a lot of things as well, but they basically mirror a lot of things that we can do with the input element already.

37:24 --> 37:32
things like ARIA checked, it's HTML checked basically, but also things like ARIA invalid

37:32 --> 37:40
or ARIA required. These are, as I have said, only applicable for users with screen readers.

37:41 --> 37:49
So ARIA required will not trigger the browser's required validation. It will not do anything

37:49 --> 37:56
to prompt the user to fill out the required. The only thing that aria-required does is to announce

37:56 --> 38:03
to the screen reader that this is a required field. And depending on your use case, that might

38:03 --> 38:12
be the better thing to do. So there are a couple of those. aria-level, for example, is if you have

38:12 --> 38:19
headings, heading level three, you would have role heading, and then aria-level three. So that would

38:19 --> 38:25
the equivalent. Of course, you can type h3, so why would you do anything else in this case?

38:27 --> 38:30
Then you have aria-sort for sorted tables and stuff like this.

38:31 --> 38:37
So there's a lot of information that you can convey.

38:40 --> 38:45
Then we have the life region attributes. Those are aria-atomic, aria-busy, aria-live,

38:45 --> 38:55
and aria-relevant. Really quickly as the overview, aria-live switches live regions on and off. So

38:55 --> 39:03
you can say aria-live, I think it's off, as there's no live region. Then you have aria-live-polite,

39:03 --> 39:10
which is basically what the status does. It waits until the last announcement and then announces

39:10 --> 39:16
whatever you have put into the live region. Or you could do aria-live assertive and that would

39:18 --> 39:27
basically interrupt the current announcement and blurt out whatever you put in there.

39:28 --> 39:34
aria-busy is used as a true/false for when you cannot interact with something. You can say,

39:34 --> 39:42
"Oh, the website is busy, wait a second." That can be useful. If you set aria-atomic true,

39:42 --> 39:49
that means the whole live region is red. And if you set aria-atomic false, which is the default,

39:50 --> 39:59
then only the changes or added text will be red. And what is red? That is defined by aria-relevant.

39:59 --> 40:08
So if aria-relevant, you can say edit text, remove text, and stuff like that.

40:09 --> 40:21
There are also drag-and-drop attributes in aria-1.2, but they're all too deprecated since aria-1.1.

40:21 --> 40:22
So I will not talk about them.

40:26 --> 40:29
And then there are a couple of relationship attributes.

40:29 --> 40:47
So this is basically to make sure that if you have something like a table and you want to announce the row, you can actually use ARIA row index for the current row you're in.

40:47 --> 40:52
And then row count for the number of the rows.

40:52 --> 40:55
But this is all built into HTML.

40:55 --> 40:58
If you use a proper table, you don't need to think about that.

41:01 --> 41:06
Theoretically, ARIA flow 2 would be nice to say like, hey, go there after this.

41:06 --> 41:08
But nothing supports that.

41:09 --> 41:13
So support is a big question mark.

41:16 --> 41:24
And those are all the attributes and the states and properties.

41:24 --> 41:30
If you have questions on any of those, if something jumps out at you, feel free to just ask.

41:30 --> 41:37
And I can explain that further and also explain if it is actually supported in practice or not.

41:38 --> 41:42
Which is always the question with these ARIA things.

41:43 --> 41:47
There are a couple of rules of how to use ARIA in HTML.

41:47 --> 42:03
And I've tried to hit them all during what we talked about, but they are actually in this really nice document called Using ARIA that Steve Faulkner and others are working on.

42:04 --> 42:10
And it's a really nice summary of what you should and shouldn't do with ARIA when you're using it in HTML.

42:11 --> 42:13
And so let's go to the first rule of ARIA.

42:14 --> 42:29
If you can use a native HTML element or attribute with the same semantics and behavior you require, already built in, instead of repurposing an element and adding aria-role, state, or property to make it accessible, then do so.

42:29 --> 42:36
So, if you need a button, don't use a div with a role button, just use the button element.

42:36 --> 42:38
That's basically what this says.

42:39 --> 42:47
Make sure that whenever there is something in HTML that meets your use case, that you use that.

42:49 --> 42:55
Second rule of ARIA is do not change native semantics unless you really, really have to.

42:56 --> 43:00
And I would add, and you know what you're doing, because this can go wrong really quickly.

43:01 --> 43:03
So here's a bad example.

43:03 --> 43:07
It's an H2 roll button detailed information.

43:08 --> 43:19
Now I talked about, so the use case would be the programmer wants a heading and when you click the heading it expands and collapses some detailed information.

43:20 --> 43:24
And the thing is twofold.

43:24 --> 43:29
So first just putting row button on the H2 does not make the H2 interactive.

43:29 --> 43:39
It just gets announced differently to screen readers, but actually tabbing to the H2 or doing anything with that, that doesn't work because it's not defined.

43:40 --> 43:41
It's just a different role.

43:42 --> 43:47
And the other thing is that this H2 now ceases to be a heading level 2.

43:49 --> 43:54
Those roles are only like replacing, you can't add them to each other.

43:54 --> 43:57
That would be neat, but that's not how they work.

43:58 --> 44:03
So if you put H2RollButton, this heading is not a heading anymore.

44:03 --> 44:05
It's now a button only.

44:06 --> 44:11
So if you're using heading navigation, for example, you would skip right over it.

44:12 --> 44:25
And even in this case, if you use tab navigation and want to activate it, it won't work because you can't actually move your focus on the button.

44:25 --> 44:31
A much better way is to just use the H2 as you did before and then use the button element

44:31 --> 44:37
inside it and boom, your expand collapse is more accessible.

44:37 --> 44:39
It's really simple.

44:39 --> 44:44
And so you should always, you know, always thinking about like, oh, can I do this through

44:44 --> 44:50
nesting or can I do that in a better way?

44:50 --> 44:55
A third rule of ARIA use is all interactive ARIA controls must be usable with a keyboard.

44:55 --> 45:02
So we just talked about that, like this pseudo button was not a keyboard usable.

45:03 --> 45:09
And if you use a roll button, then you need to make sure that the button can receive focus

45:09 --> 45:17
and that a user must be able to activate it both with the enter or return key or with

45:17 --> 45:23
the space key, because that's how a user assumes that those buttons will work.

45:24 --> 45:29
And that's super important also for the different like widget roles and other things.

45:29 --> 45:37
There is, we see that in a couple, I will point you at the documentation for that.

45:38 --> 45:48
Basically, all these like more complicated user interface components, they have their own requirements on how they must be used with the keyboard.

45:48 --> 45:53
Because basically, you're making a promise with the role on how this would work.

45:54 --> 46:03
And if you don't keep that promise, then it will be much, much harder for a user to interact with the widget.

46:06 --> 46:12
Fourth rule of ARIA, do not use role presentation or ARIA hidden true on a focusable element.

46:12 --> 46:17
And as I said, role none is the same as role presentation.

46:19 --> 46:25
And when you use either of those, it might result that users are focusing on nothing.

46:26 --> 46:30
So basically you tap to a button and has a role presentation on it.

46:31 --> 46:35
It will just read the text inside of the button like it would be a text field.

46:35 --> 46:40
But there's no announcement that it is a button because you removed the role.

46:40 --> 46:44
That happens when you use role presentation or role none.

46:44 --> 46:53
If you use aria-hidden-true, that hides the element completely from the accessibility tree.

46:54 --> 47:00
So in that case, you could tap to it, but there will be just no announcement.

47:01 --> 47:03
It will be just silence.

47:03 --> 47:06
And obviously, that's not a good interaction.

47:06 --> 47:09
So this is not allowed.

47:09 --> 47:09
Don't do it.

47:09 --> 47:19
And this, by the way, also applies to stuff that is inside of elements that have those, that have aria-hidden set, for example.

47:20 --> 47:23
So I do have examples.

47:23 --> 47:29
So if I have an aria-hidden true and a button inside of that, then that button is also hidden.

47:29 --> 47:39
And you can tap to it or you can move to it using the screen reader and you would have no announcement at all.

47:39 --> 47:47
And the final rule, rule number five, is all interactive elements must have an accessible name.

47:47 --> 47:49
We talked about accessible names.

47:50 --> 47:52
And yeah, that's just the rule.

47:53 --> 48:00
Don't do, yeah, use accessible names.

48:00 --> 48:02
Make sure that they have them.

48:03 --> 48:04
All right.

48:04 --> 48:06
I know that this is a lot.

48:06 --> 48:10
So I want to leave you with some further reading and information.

48:12 --> 48:17
You don't have to read all of this because I think it's like 7 million pages of things.

48:18 --> 48:24
But just so you have an impression and if you have more questions, go there.

48:24 --> 48:34
And if you have any questions further from that, please bring them up and ask so we can talk them through because that's always most useful.

48:35 --> 48:39
As I said, this is like super complicated and it's mostly for developer type.

48:40 --> 48:47
And as testers, we just need to know what to find where and what is like the rough structure.

48:47 --> 48:57
And then once you come across something that doesn't work in your screen reader or on an ongoing basis, you go and you look up what's going on.

48:57 --> 49:06
And to look up what's going on, there's this way ARIA overview page, which introduces the whole standard.

49:06 --> 49:11
They say it's a suite of web standards, which is probably true.

49:12 --> 49:15
That includes using ARIA in HTML.

49:16 --> 49:23
That also includes things like how does native HTML map to ARIA and stuff like that.

49:23 --> 49:30
So there's a lot of good information there on the standard and how it works and for different use cases.

49:31 --> 49:35
And then the next one is the ARIA authoring practices guide.

49:35 --> 49:40
Now, the authoring practices guide, that looks like a list of patterns.

49:41 --> 49:44
And we will go through that one in the live session.

49:46 --> 49:56
And the purpose of the ARIA practice guide is not to give developers practical information.

49:56 --> 50:01
The purpose is to illustrate appropriate use of ARIA as defined in the specification.

50:01 --> 50:09
So you see in there your diff roll button with like terrible complicated constructs

50:09 --> 50:13
to make it an actual clickable and tappable and keyboard operatable button.

50:15 --> 50:16
But you should not do that.

50:17 --> 50:20
Like, this is what the authoring practice guide does.

50:21 --> 50:28
And it's mostly to test ARIA and make sure that that works.

50:31 --> 50:40
Yeah, and the other thing is that the ARIA examples also generally do not have any touch or mobile considerations with it,

50:40 --> 50:44
which makes them pretty, like, medium useful in my point of view.

50:44 --> 50:54
but it's a good way to see how some of the roles and states and properties can interact with each other.