Your daily frequent11y newsletter, brought to you by @ChrisBAshton:
Practical accessibility, part 2: Name (almost) everything
- It’s not enough to just use semantic markup to, say, create a list in HTML (the “what”), and mark it up with a
role="menu"
(the “how it’s supposed to work”). We also often need to label the list, to explain “why” it’s there. For example, anaria-label="Main menu"
to give some extra context to screen reader users. - This article describes how and when you should name things in HTML. It covers the basics, such as associating a label with an input, which effectively gives the input a name, but it also covers the stuff that is more easily omitted, such as applying a label to your ARIA regions.
- Not every landmark needs a name, but any
navigation
,form
andregion
should, as well asmain
(it’s good practice to associate the H1 element with the main content in your page viaaria-labelledby
). Landmarks that appear once per page, such asbanner
, should not have a name.
Prefer longer newsletters? You can subscribe to week11y, fortnight11y or even month11y updates! Every newsletter gets the same content; it is your choice to have short, regular emails or longer, less frequent ones. Curated with ♥ by developer @ChrisBAshton.