<strong>Web accessibility is often said to be a 'must' for the World Wide Web today. The term "web accessibility" defines a set of guidelines developers need to follow to make the interaction of people with disabilities and web apps more convenient. Any website should be accessible in terms of its content, UI/UX design, and layout. In this article, the Logicify team gives HTML/CSS developers a few practical tips to make web layouts more accessible — both for people and assistive devices.</strong>
Web accessibility is often said to be a 'must' for the World Wide Web today. The term "web accessibility" defines a set of guidelines developers need to follow to make the interaction of people with disabilities and web apps more convenient. Any website should be accessible in terms of its content, UI/UX design, and layout. In this article, the Logicify team gives HTML/CSS developers a few practical tips to make web layouts more accessible — both for people and assistive devices.
Whatever markup you are using, structure it correctly and neatly, avoid skipping levels. Always favor native elements (if there are ones) over faking them. For instance, use the
<button> elements instead of
<div> in HTML. Use
<nav> for navigation,
<button> for page actions.
<em> elements from
<i>. The former two are used for semantic emphasis on the content, the latter two for visual emphasis.
<lang>attribute to tell the browser which language(s) is used on a website.
Both the user and the machine (screen readers, Braille displays) should be able to recognize the page structure. Create semantic layouts by making use of sectioning (
<nav>) and heading elements on a page. This helps to define a clear hierarchic outline of a web page and distinguish primary (main:
<article>) and secondary (less important:
As you use headings within a page, do not fake the actual markup of header attributes (
<h>) with formatting (font style and size) as this does not allow assistive technologies to recognize that these are headers.
Here is an example of how HTML semantic elements (
<footer>) are combined with ARIA role attributes (“banner”, “navigation”, “main”, “contentinfo”) to make website navigation using a screen reader easier for people with disabilities.
Though most ARIA functions were recently implemented in HTML5 (and you should definitely favor these!), not all screen readers and browsers (e.g. IE) are sophisticated enough to depend on HTML semantics only. Some examples of appropriate ARIA use are assigning roles to describe some types of widgets ("menu”, “treeitem”, “slider”), defining properties for drag-and-drop that describe drag sources and drop targets, and adding alerts to notify assistive technologies about dynamic page changes.
Make Tab order (also called Document Object Model or DOM order) of elements coincide with the visual one. Remove unnecessary elements from the Tab order not to confuse the user who navigates with Tab or assistive device.
Make the focus of navigation elements visible. You could use a third-party plug-in for this or the
<outline> attribute that provides visual feedback for page elements and links that have focus while tabbed navigation (or its alternatives).
<tabindex> attribute to make elements such as links, buttons, and form fields focusable and selectable with the Enter key and/or spacebar. Even non-focusable elements with the
<tabindex> attribute and 0 integer value could be made focusable, e.g.
<h3 tabindex="0">A focusable heading</h3>
If there are pop-up windows on a page, navigation priority should allow to close them first. Once this is done, the focus should ideally jump back to the web page element where the user was interrupted by the opened modal window. To achieve this, store the last focused element in a variable.
Almost all the content on a page can be accessed by screen readers — except for graphical information. So do not forget to add alternative text (
<img> alt attribute) for images and other pieces of graphics. This will aid not only people who use assistive technologies to “read” the screen but also users with a poor Internet connection. Your website will also become SEO optimized with image alt texts.
Image alt text should be precise, laconic, and reflect the primary purpose of why the image was added. Depending on the context, the very same image could have different alternative texts, e.g. if the company logo is placed in the header and returns the user to the Home page, the accurate alt text for it could be
<img alt="Company X logo - Home page.">
While it is imperative to add alt text for all images that are important for an understanding of the content, there is no need to do so for menu icons or decorative images (like covers), which do not directly relate to the content. For such images, simply use an empty
<img alt> attribute.
Though these tips would definitely add to your website’s inclusive nature, it is better not to think about web accessibility as a formal set of guidelines. It is, first and foremost, a comprehensive strategy to care about all users and make your website content available for them — no matter the browser, Internet provider, or assisstive device they are using.
Originally published by Daryna Tkachenko at https://dzone.com
Introduction To HTML & CSS: Web Development For Beginners - Complete HTML & CSS web developer bootcamp. Learn & practice website design using HTML5 & CSS3 web development resources
The Ultimate Guide to Web Development with HTML and CSS. Learn Web Development by creating a Blog with HTML and CSS. Make a web applications using HTML5 and CSS3. Create a blog from Scratch.
Build your eCommerce project by hiring our expert eCommerce Website developers. Our Dedicated Web Designers develop powerful & robust website in a short span of time.