Creating HTML Layouts That Meet Web Accessibility Standards

Creating HTML Layouts That Meet Web Accessibility Standards

<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.

Keep the Markup Clean

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 <span> or <div> in HTML. Use <nav> for navigation, <button> for page actions.

Distinguish <strong> or <em> elements from <bold> or <i>. The former two are used for semantic emphasis on the content, the latter two for visual emphasis.

  • A few obvious things which have already become best practices:
  • Make sure the company logo in the banner links back to the website’s home page.
  • Use the <lang> attribute to tell the browser which language(s) is used on a website.
  • If you want to hide content visually and from screen readers, use the hiddenattribute.
  • Add anchor links (jump links) for long pages, so users could skip the content they do not need and proceed to the relevant part.

Mind the Page Semantics

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 (<header><footer><article><nav>) and heading elements on a page. This helps to define a clear hierarchic outline of a web page and distinguish primary (main: <h1><h2><article>) and secondary (less important: <h3> - <h6><footer>) content.

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.

Use ARIA landmarks across the web pages where appropriate. ARIA (Accessible Rich Internet Applications) is a comprehensive technical specification for adding accessibility information to elements that are not natively accessible (in particular, the ones developed with JavaScript, AJAX, and DHTML). With ARIA landmarks, a developer can extend HTML capabilities and apply proper semantics, i.e. properties, to UI and content elements for assistive technologies to understand these.

Here is an example of how HTML semantic elements (<header><nav><main><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.

Support Tab Navigation

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).

Use the<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.

Add Alternative Text for Images

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.">

  • In alt text, avoid the redundant “image of” or “picture of” — either way the assistive technology warns the user that there is an image.
  • End the alt text with a period. This will make screen readers pause a bit after the last word in the alt text, hence it will provide a more pleasant experience for the user.
  • The alternative text for an image that has multiple clickable areas (e.g. image map) should provide a complete description for these links. Additionally, each clickable area should have corresponding alternative text describing its purpose or destination.
  • Avoid images of text; if you cannot go without them, the alternative text should contain the very same words as in the image.
  • If you have multiple images conveying a single piece of information, the alternative text for the first image in the group should contain the information for the entire group.
  • To familiarize yourself with generally accepted standards for alt texts, you could always check this Alt Text Decision Tree.

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.

Last Tip

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

Learn More

☞ The Web Developer Bootcamp

☞ Build Responsive Real World Websites with HTML5 and CSS3

☞ Web Design for Beginners: Real World Coding in HTML & CSS

☞ Beginner Full Stack Web Development: HTML, CSS, React & Node

☞ The Complete HTML & CSS Course - From Novice To Professional

☞ The Ultimate HTML Developer

☞ CSS - The Complete Guide (incl. Flexbox, Grid & Sass)

Introduction To HTML & CSS: Web Development For Beginners

Introduction To HTML & CSS: Web Development For Beginners

Introduction To HTML & CSS: Web Development For Beginners - Complete HTML & CSS web developer bootcamp. Learn & practice website design using HTML5 & CSS3 web development resources

Welcome to Introduction To HTML & CSS: Web Development For Beginners: This is a comprehensive and Practical guide that is designed to pick up every interested student from the state of "zero-knowledge" to a state of "Hero-knowledge" in HTML and CSS. As a senior software developer and an instructor with many years of experience in the industry, I have mastered the best way to give my students packages that will help them to learn and understand HTML and CSS in one course.

What you'll learn

  • You will learn the basics of web development
  • You will be able to use the HTML tags professionally
  • You will learn how to work with images in HTML and CSS
  • You will learn how to create awesome backgrounds
  • You will how to use CSS colors
  • You will master most web development documentations used by professionals
  • You will learn how to embed multimedia in web pages
  • You will learn how to make comments in both HTML and CSS
  • You will learn the Box Model

Mobile App Development Company India | Ecommerce Web Development Company India

Mobile App Development Company India | Ecommerce Web Development Company India

Best Mobile App Development Company India, WebClues Global is one of the leading web and mobile app development company. Our team offers complete IT solutions including Cross-Platform App Development, CMS & E-Commerce, and UI/UX Design.

We are custom eCommerce Development Company working with all types of industry verticals and providing them end-to-end solutions for their eCommerce store development.

Know more about Top E-Commerce Web Development Company

Web Development Services

Web Development Services

As one of the best Web Application Development Company, it provides a fine quality mobile app development service at an affordable price. Especially, it encourage start-ups that have unique ideas, by offering a more competitive price

HireFullStackDeveloperIndia is rated as one of the top Web Application Development Company in India by various industry magazines and review sites. They have a right blend of award-winning designers, expert programmers and Google certified digital marketers which make them a unique one-stop solution for hundreds of our clients, spread across all countries.

A Good website reflects not only your business but also it is one of the main factors why a potential customer would convert into Client. A good website design helps increase traffic driving leads to grow business. The best web design company create a custom design for each corporate website so as to help them meet their business goals.

Get Quote: https://hirefullstackdeveloperindia.com/get-a-quote/