diff --git a/guide/english/accessibility/accessibility-basics/index.md b/guide/english/accessibility/accessibility-basics/index.md index 1bda20c6ae..5609300f74 100644 --- a/guide/english/accessibility/accessibility-basics/index.md +++ b/guide/english/accessibility/accessibility-basics/index.md @@ -8,68 +8,67 @@ title: Accessibility Basics > > --Professor Severus Snape, Harry Potter Series -Accessibility's role in development is essentially understanding the user's perspective and needs, and knowing that the web, and applications are a solution for people with disabilities. +Accessibility's role in development is understanding the user's perspective and needs. -In this day and age, more and more new technologies are invented to make the lives of developers, as well as users, easier. To what degree this is a good thing is a debate for another time; for now, it's enough to say the toolbox of a developer, especially a web developer, is as ever-changing as the so-called "dark arts" are according to our friend Snape. +As more and more new technologies are being created, the toolbox of a developer becomes ever-changing and complicated. -One tool in that toolbox should be accessibility. It is a tool that should ideally be used in one of the very first steps of writing any form of web content. However, this tool is often not all that well presented in the toolbox of most developers. This could be due to a simple case of not knowing it even exists to extreme cases like not caring about it. +One tool in that toolbox should be accessibility. It should be one of the very first steps of creating any form of web content, yet is not considered enough. This could be due to a simple case of not knowing it even exists or an extreme case like not caring about it at all. -In my life as a user, and later a developer, who benefits from accessibility in any form of content, I have seen both ends of that spectrum. If you are reading this article, I am guessing you are in one of the following categories: +If you are reading this article, you may be in one of the following categories: * You are a novice web developer and would like to know more about accessibility. * You are a seasoned web developer and have lost your way. (More on that later.) * You feel that there is a legal obligation from your employer, and you need to learn more about it. -If you fall outside these rather broad categories, please let me know. I always like to hear from the people who read what I write about. Implementing accessibility impacts the entire team, from the colors chosen by the designer, the copy written by the copywriter, and to you, the developer. +Implementing accessibility impacts the entire team, including the designer, the copywriter, and the developer. ## So, what is accessibility anyway? -Accessibility in itself is a bit of a misleading term sometimes, especially if English is your second language. It is sometimes referred to as "inclusive design." +The word "accessibility" in itself can be a bit misleading at times, especially if English is your second language. It is sometimes referred to as "inclusive design". -If your site is on the Internet, reachable by anyone with a web browser, that website is accessible to everyone with a web browser. +In one sense, if your site is public on the Internet, that website is accessible to everyone with a web browser. -But, is all content on your website actually readable, usable, and understandable for everyone? Are there no thresholds that bar certain people from "accessing" all the information you are exposing? +But is all the content on your website actually readable, usable, and understandable for everyone? Are there no thresholds that bar certain people from "accessing" all the information you are exposing? -You could ask yourself questions like the following: +You could ask yourself questions such as the following: -* If you add information that is only contained in an audio file, can a deaf person access that information? -* If you denote an important part of your website with a certain color, will a colorblind person know about it? -* If you add images on your website that convey important information, how will a blind or low-vision person know about it? -* If you want to navigate the application with keyboard or mouth-stick, will it be possible and predictable? -* Does your application assume the orientation of the device, and what if the user can't physically change it? -* Are there forgiving timed aspects of your application when someone might need more time to fill in a form? -* Does your application still work (progressive enhancement) assuming that JavaScript does not load in time? -* If your website is very resource-heavy, will someone on an older device with a slow or spotty connection be able to access your content? +* If you add information contained in an audio file, can a deaf person still get that information? +* If you denote an important piece of content with a certain color, will a colorblind person know about it? +* If you add images that convey important data, how will a person with low vision get that information? +* Is it easy to navigate the application with only a keyboard or mouth-stick? +* Does your application assume the orientation of the device? What if the user can’t physically turn the device? +* Are the timed aspects of your application forgiving to someone that might need more time to fill in a form? +* Does your application still work even if JavaScript does not load in time? +* If your website is very resource-heavy, will someone on a slow internet connection be able to read your content? -This is where accessibility comes into play. Accessibility basically entails making your content as friendly, as easy to "access" as possible for the largest amount of people. This includes people who are older, deaf, low-vision, blind, dyslexic, colorblind, have epilepsy, have mental fatigue, have physical limitations, cannot afford new devices or high-speed connections, etc. +This is where accessibility comes into play. Accessibility entails making your content as friendly, as easy to "access", as possible for the largest amount of people. This includes people who are older, are deaf, have low-vision, are blind, are dyslexic, are colorblind, have epilepsy, have mental fatigue, have physical limitations, cannot afford new devices or high-speed Internet connections, etc. -## Why implement accessibility? +## Why worry about accessibility? -You may think that accessibility doesn't apply to you or to your users, so why implement it? What would a blind person do with a photo editing tool? +You may think that accessibility doesn’t apply to you or to your users, so why bother implementing it? What would a blind person do with a photo editing tool? -The truth is, you're right to a certain degree. If you have done meticulous user research and have excluded any chance of a certain group of people visiting your website, the priority for catering to that group of people diminishes quite a bit. +The truth is, you're right to a certain degree. If you have done meticulous user research and have excluded any chance of a certain group of people visiting your website, the priority for catering to that group diminishes quite a bit. -However, doing this research is key in actually defending such a statement. Did you know there were blind gamers? and even blind photographers? Perhaps you knew musicians can be deaf? +However, doing this research is actually key in defending the need for accessibility. Did you know there are blind gamers? Even blind photographers and deaf musicians? -If you did, good for you. If not, I guess this drives my point home all the more. +There is also legislation that actually forces you to make certain websites and web apps accessible. A prime example is the US-based Section 508. Right now, this law mainly refers to government organizations and public sector websites. However, laws can change. The picture gets even more complicated when we look at legislation that actually forces you to make certain websites and web apps accessible. A prime example is the US-based Section 508. Right now, this law mainly refers to government organizations, public sector websites, etc. However, laws change. -Last year, airline websites were included in this list which meant that even here in Europe, airline website devs scrambled to make their content accessible. Not doing so can get your company a fine of literally tens of thousands of dollars for each day the problem isn't fixed. +Last year, airline websites were included in this list which meant that in Europe, airline website devs scrambled to make their content accessible. Not doing so can get your company a fine of literally tens of thousands of dollars for each day the problem isn't fixed. -There are variations on this legislation all over the world, some more severe and all-encompassing than others. Not knowing about that fact doesn't make the lawsuit go away, sadly. +There are variations on this legislation all over the world, some more severe and all-encompassing than others. Not knowing about that fact doesn't make the lawsuit go away. ## Ok, so accessibility is a big deal. Now how do we implement it? +That question, sadly, is harder to answer than it may seem. -That question, sadly, is harder to answer than it may seem. The Harry Potter quote at the top is there for a reason, and it's not my being an avid fantasy reader. +As stated above, accessibility is important for a large group of different people, each with their own needs. Making your website work for everyone is a large, on-going task. -As stated above, accessibility is important for a large group of different people, each with their own needs. Making your website work for literally everyone is a large, on-going task. - -The Web Content Accessibility Guidelines or WCAG were composed to help developers create accessible content. This document contains a number of criteria you can use to check your website. For now, I will cover some of the most important basics here. I will point you at the low-hanging fruits, so to speak. In subsequent articles, I will discuss more advanced techniques like [WAI-ARIA] which is important for JavaScript-based apps. +The Web Content Accessibility Guidelines or WCAG were composed to help developers create accessible content. This document contains a number of criteria you can use to check your website. There are also advanced techniques like [WAI-ARIA] that are important for JavaScript-based apps. ### Talk like the natives -The HTML specification is a document that describes how the language should be used to build websites. Assistive technologies, like screen-readers, speech recognition programs etc. are aware of this document. Web developers however, often are not, or at least not enough, and think something like this is ok: +The HTML specification is a document that describes how the language should be used to build websites. Assistive technologies, like screen-readers, speech recognition programs etc. are aware of this document. Web developers, however, often are not, or at least not enough, and think something like this is ok: ```html
@@ -79,13 +78,13 @@ The HTML specification is a document that describes how the language should be u ``` Guess what? All three of these elements break several criteria of WCAG and therefore are not accessible at all. -The first element breaks the so-called "name, role, value"-criterium, which states that all elements on a web page should expose their name, their role (like button) and their value (like the contents of an edit field) to assistive technologies. This div actually doesn't provide any of the three, rendering it invisible to screen-readers. +The first element breaks the ‘name, role, value’-criterium, which states that all elements on a web page should expose their name, role (e.g. button) and value (e.g. the contents of an edit field) to assistive technologies. This div actually doesn’t provide any of the three, rendering it invisible to screen-readers. -The second element looks like a heading visually after styling it with CSS, but semantically is a span. Therefore, assistive technologies won't know it's a heading. A screen-reader will read this as regular text, instead of a heading. Screen-readers often have a hotkey to quickly jump to the nearest heading, this heading will not be included in that scope. +Visually, the second element looks like a heading after styling it with CSS, but semantically it is a `span`. Thus, assistive technologies won’t know it's a heading. A screen-reader will read this element as regular text instead of a heading. Screen-readers that use a hotkey to jump between headings would skip this element. -The third element could for example be an element a user can click to change the language of the website. Maybe a fancy animated menu of languages will expand when it is clicked. However, this is also a span and does not expose its role (link, or button), making assistive technologies think this is just the word English with some styling. +The third element could be something used to change the language of the website. Perhaps a fancy animated menu of languages will expand on click. However, because it is a `span` and does not define its role as link or button, assistive technologies will think this is simple text with some styling. -Spans and divs are non-elements. They are meant to contain other elements, not to be elements themselves. You can fix these in two ways: +`Span`s and `div`s are non-elements meant to contain other elements, not to be elements themselves. You can fix these in two ways: * You can manually add ARIA-attributes to the elements above. This is an advanced topic and outside the scope of this article. * Or, you can simply do this: @@ -96,7 +95,7 @@ Spans and divs are non-elements. They are meant to contain other elements, not t English ``` -Boom. Suddenly, all these elements are now perfectly accessible, just by using native HTML. HTML the way it was meant to be used, in other words. +Boom. Suddenly, all these elements are now perfectly accessible, just by using native HTML. HTML used as intended, in other words. ### How do pages begin? ```html @@ -106,88 +105,81 @@ We copy it from some template and mostly don't even know it is there. These word ### A foundation cannot stand without structure -A bit earlier, I touched upon a screen-reader's hotkeys to jump from heading to heading. There are in fact many hotkeys like this to quickly jump to the nearest table, form field, link etc. Making sure these headings are actually in logical places is therefore a good practice and really decreases your assistive technology users' stress levels, which is good if you want visitors to keep coming back to your website. +As mentioned earlier, screen-readers have hotkeys to jump from heading to heading. There are also hotkeys to jump to the next table, form field, link, etc. Thus, it is good practice to make sure these headings are actually in logical places. It also decreases users’ stress levels, which encourages them to keep coming back to your website. -Also remember that headings are hierarchical. If you use an h2, make sure the h3's that follow it actually have something to do with that h2\. Don't put an h3 for contact details under your h2 for recent blog posts. A good analogy here is a book with chapters, that have subsections. You wouldn't put a section on baking cookies in the middle of a chapter on preparing vegetables ...or ...you wouldn't... right? +Also remember that headings are hierarchical. If you use an `h2`, make sure the `h3`s that follow it actually have something to do with that `h2`. Don't put an `h3` for contact details under your `h2` for recent blog posts. A good analogy here is a book with chapters, that have subsections. You wouldn't put a section on baking cookies in the middle of a chapter on preparing vegetables, right? ### What's the alternative? +Images on a website are great. They add a new layer to your content, make experiences more immersive, and generally look good among all the text. A picture can say more than a thousand words, right? -Images on a website are great. They add a new layer to your content; can really make the experience your site visitors have way more immersive and generally just look good among all that text. A picture can say more than a thousand words, right? +Certainly. That is, if you can see them. In the HTML5-specification, an img-attribute must always have an alt-attribute. This attribute is meant as an alternative to the image in case it is not visible. This would be true for blind visitors to your website, but also when your image doesn't load for some reason. Not adding an alt-tag to an img-attribute not only breaks accessibility, it goes against the HTML5-spec. -Certainly. That is, if you can see them. In the HTML5-specification, an img-attribute must always have an alt-attribute. This attribute is meant as an alternative to the image in case it can't be seen. This would be true for blind visitors to your website, but also when your image can't be loaded for some reason. Not adding an alt-tag to an img-attribute is therefore not only breaking accessibility, but going against the HTML5-spec. +Now, there is one caveat here. Alt-attributes are mandatory according to the HTML5-spec, but it is not mandatory to fill them in. `input
tag. This little guy is kind of important.
+While on the topic of forms, let's look at the input
tag. This little guy is kinda important.
-When you put some input fields on a web page, you can use labels to ...well ...label them. However, putting them next to each other is not quite enough. The attribute you want is the for-attribute, which takes the ID of a subsequent input field. This way, assistive technologies know what label to associate with what form field.
+When you put input fields on a page, you can use `labels` to label them. However, putting them next to each other is not quite enough. The attribute you want is the for-attribute, which takes the ID of a subsequent input field. This way, assistive technologies know what label to associate with what form field.
-I guess the best way to illustrate this is by giving an example:
+The best way to illustrate this is by giving an example:
```html