Digital accessibility on the internet
Good and bad practices
What to know when building a website or web application
6 things worth knowing when designing a website
There is hardly a website today without images and links. The basic rule when creating digitally accessible content is to provide good descriptions for elements such as hyperlinks and images. Images can be divided into decorative ones and those that carry important content.
6 things to keep in mind:
- Remember: every “informative” image on a page should have an alternative description. If an image carries important content, describe it so that it is understandable to people who cannot see it. It can be a description of what the image shows or, if it contains some text, that very text.
- For developers: If the image description is longer, you can use the figure and figcaption tags or point to the element containing the long description in the longdesc attribute. For a group of images, e.g. photos of building blocks, you can add a description to just one and leave the alt attribute empty on the rest.
- Websites often use clickable images instead of buttons with text. For images that trigger an action, the alt attribute should describe the result of that action, e.g. submit the form.
- If an image is purely decorative, skip the description. Likewise, if an image adds no extra content, e.g. it summarises information that appears elsewhere on the page, you can treat it as decorative and leave the alt attribute empty.
- For developers: Decorative images should have an empty alt attribute or be placed using a CSS stylesheet.
- When creating image maps, describe both the main image element and each of its highlighted areas.
- For links, describe exactly where they lead and what their purpose is, i.e. what will happen after clicking the link. Links should also be clearly distinguished in the page content so it is easy to tell that a piece of text leads to other content. If the link text alone is not clear enough, fill in the title attribute.
- For developers: Sometimes it is worth considering aria-label instead of title.
- We often complement page content with various graphics, e.g. icons symbolising an action. Such decorative elements should be created with CSS styles or hidden from screen readers. At the same time, make sure the action itself is properly described.
3 rules worth knowing when creating a form on a website
Practically every website has a form, e.g. a contact form or a newsletter sign-up. When talking about good practices for building accessible websites, we cannot forget about the accessibility of forms. Unfortunately, the main emphasis is often placed on looks and aesthetics rather than on making forms easy to use with screen readers. Ensuring accessibility does not require much effort. You only need to remember 3 rules.
- Every form field should have its own description.
- For developers: Always use the label tag with an input field. It does not matter whether the input has a placeholder. Screen readers do not see it.
- Give the form a title that states its purpose.
- For developers: You can set it using the aria-labelledby attribute.
-
If you use a so-called captcha, pay attention to its accessibility.
- Captchas are often added to forms to protect against various kinds of bots. Be careful with this, because most of them are not accessible to all users. For example, people with dyslexia have trouble with every kind of captcha, not to mention image captchas for blind people and audio ones for people with hearing difficulties. There are solutions that detect an unnaturally quickly filled-in form or use a blacklist of servers. This makes it possible to catch bots. Methods you can use instead of a captcha include, for example, adding SMS or email verification. Another clever idea is to add an invisible checkbox to the page that a user will not tick, whereas a bot will usually tick it. Biometric verification can also be used.
How to make navigating your website comfortable?
We most often move around a website using a mouse, a touchpad or the touch screens of mobile devices. However, a large group of users uses only the keyboard. People who use a mouse also often prefer to perform actions on a page without having to click and precisely hit page elements with the cursor, e.g. when filling in a form.
The keys used to navigate a page are:
- tab (next element) or tab with shift to go back,
- space and enter to activate an element or confirm,
- arrow keys to move around lists, tabs and tables,
- esc to close pop-up notifications,
- or backspace to cancel.
4 things to remember if you want to provide comfortable keyboard operation
- Correct order of elements on the page. A very important matter is the correct order of elements on the page. You can control this order using the HTML attribute tabindex. It is used to define the order of navigation through elements that can receive focus, i.e. can become active.
- For developers: You do not need to set it for elements that take focus by default, such as input, button, select, textarea, a, area. Set it for your own components.
- Keyboard shortcuts. It is also worth introducing easily accessible keyboard shortcuts for the most important functions.
- For developers: Remember to mark them with the aria-keyshortcuts attribute, and note that the marking alone is not enough: you must also add event handling in JavaScript.
- Highlighting active elements. Make sure elements that have focus are visually highlighted.
- For developers: This is most often done with the outline style property. Do not remove it for focused elements. Of course, you can adapt it to the visual identity of the project.
- Easy closing of pop-up windows. If you have pop-up windows, make sure they can be easily closed with the Esc key.