This principle states that all content must be in a format (or available on demand in a format) which can be readily perceived by the user. Said another way, your websites should be designed such that anyone can 'read' the content, regardless of any disability they may have. Many users with disabilities will use assistive technologies; for example those with visual impairments may use a screen-reader, which reads out what appears on the screen, or a text-to-braille converter. The goal then is to facilitate these assistive technologies.
Please remember that the guidelines here are not exhaustive, so you should always refer to the Web Content Accessibility Guidelines.
This is perhaps the most common advice for improving accessibility. If your website contains any images, then these are ignored by screen-readers unless you use the alt
tag.
Note that the alt description might not necessarily be a description of what the image is, but rather what the image is trying to convey. The alt tag says in words what you're trying to say with the image.
While this advice is mostly suited to editors, I raise it here because theme developers will often provide for a logo instead of text to convey the name of the website or company. In this instance, it is probably best to use the site's name (get_bloginfo('name')
) as the alternative description:
echo '<p class="site-title"><a href="' . esc_url( home_url( '/' ) ) . '"><img id="logo" alt="'.esc_attr(get_bloginfo('name')).'" src="' . $logo . '">' . get_bloginfo('name') . '</a></p>';
Alt tags should not be used for purely decorative images, otherwise you are essentially forcing the user to sift through excessive and unnecessary information.
If your plugin creates a form, you may require some sort of confirmation that it is being accessed by a person rather than a computer. If you decide to provide the user with an image or audio clip, which they must then interpret, you should explain this, in text, and provide an alternative form of CAPTCHA to accommodate different disabilities.
This guideline will largely apply to plugin developers, but can also apply to themes. If colour, shape or position are used to convey a meaning that is not discernible from the text, that meaning is lost on users who are colour blind or blind.
For instance, a typical example might be contact form buttons relying solely on an icon from the popular icon font Font Awesome:
<button><span class="fa fa-envelope fa-lg"></span></button> <button><span class="fa fa-times fa-lg"></span></button>
The purpose of these buttons is readily evident to a sighted user, but for those relying on screen readers there is no indication what the buttons do. If, for design purposes, you want to avoid using text, you should specify the label using the aria-label
attribute.
<button aria-label="Email"> <span class="fa fa-envelope fa-lg"></span> </button>
This is just one example of the ARIA protocol, which we'll cover in more detail in the next article.
This is an almost obvious requirement. Even for a well-sighted person, a website with a low contrast between text and background is difficult to read and can cause eye-strain. For those with vision impairments, an even greater degree of contrast is required, which is why the WCAG states that background and text colour should have a contrast ratio of 4.5:1.
It's not immediately obvious what that ratio looks like or means, but there are a variety of tools that help you check the ratio:
Larger text has a lower requirement of 3:1, and logos, text that is pure decoration or not visible, and 'disabled' text/buttons do not have a contrast requirement.
Although most themes offer their users the ability to adjust the colours used on the website, it's a good idea to ensure that at least the default colours (or available 'palettes') meet the minimum contrast requirement. Later in this series we will look at building a feature into your theme which warns the user if they are selecting colours with insufficient contrast.
The British Dyslexia Association recommends avoiding pure white backgrounds for text and instead using an off-white colour, cream or a soft pastel colour. The reasoning behind this is that the brightness of a white page can 'dazzle' the reader.
For those suffering from Scotopic sensitivity syndrome (or Irlen syndrome), a too high contrast between background and text can exacerbate symptoms such as:
These symptoms make reading difficult and uncomfortable, and can cause eye fatigue, eye-strain, drowsiness and headaches.
In view of the previous section, the best advice is to ensure good contrast, but not too much contrast. As preferences with vary between individuals, quite what constitutes "too much" will be down to personal judgement.
A structured layout, with appropriate use of headings, makes it easier for users to understand the information being presented to them. Screen reader users rely somewhat on a 'sensible' structure to help them find their way around a page.
A quick way to test this is to view your theme with CSS and JavaScript disabled. A better way is to use Lynx which is a text-based browser. If your site's structure causes the content to appear in a disorganised fashion then it'll be hard for users using Lynx or other assistive technologies to read your website. Because users relying on such technologies do not have the advantages that CSS and JavaScript bring in aiding orientation on the page, and the flow of content, it's important that the correct reading sequence is obvious without them.
This is fairly simple to achieve: ensure HTML mark-up reflects the intended visual order. This is quite natural, and if you find that your website doesn't read well without CSS, then you've probably intentionally deviated it. As a general rule of thumb your website should follow the pattern:
This one is pretty easy to get right. The rules are simple:
<h*>
tags for headers only—not just to apply a particular style to some text.<h3>
should be nested inside a <h2>
and <h2>
inside a <h1>
. (This follows from (2)).One question that is often asked is: Should my site title be inside a <h1>
tag? The W3C recommendations indicate that while there are some cases where this would be a valid thing to do, in the context of WordPress themes, it's probably best not to use <h1>
tags for the site title. There are a couple of reasons:
<title>
tag. While this is often overlooked and a bit ugly for visual users, it is the first thing read out by screen readers. Therefore wrapping the site title in <h1>
gives it redundant prominence to screen reader users, while making the title more obvious for sighted users can be achieved without use of the header tag.Regardless of what you decide, the subsequent headers on your page should sit below it. So, articles in "The Loop" or your page titles should have <h2>
tags if you've used the <h1>
tag for your site title, and <h1>
tags otherwise.
After the post content, most themes will display the post's comments. It's natural to have "Comments" as a heading, as it's a logical break from the content, but as its tied to the post content, the heading level should reflect this. The most logical thing to do is to have the "Comments" header one level underneath the post title.
Here's an snippet from a single.php
:
<div id="content" role="main"> <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>> <h1 class="entry-title"> <?php the_title(); ?> </h1> <div class="entry-content"> <?php the_content(); ?> </div><!--.entry-content--> <?php comments_template(); ?> </div> </div>
In my example I've used an <h1>
tag for the post title, so the comments template (comments.php
) might then look something like:
<div id="comments"> <h2 class="comments-title"> <?php printf( _n( 'One Comment on %2$s', '%1$s Comments on %2$s', get_comments_number(), 'mytheme' ), number_format_i18n( get_comments_number() ), get_the_title() ); ?> </h2> //... </div>
Some users with mild visual disabilities may rely on enlarging font-sizes rather than assistive technologies such as screen magnifiers. In view of this, the WCAG guidelines specify that your site shouldn't "break" when the text is enlarged by up to 200%. "Break" here means text disappearing, colliding, overflowing out of its containers, or more generally the layout of the site being disrupted so that it is difficult or confusing to read.
Because modern browsers have become better at resizing text, using relative font sizes is not as important as it used to be (although IE9 doesn't resize font sizes defined in pixels). Regardless, it's still recommended to use relative font sizes (percentages, ems or rems). The rem unit addresses some of the issues with the em unit—and although it was only introduced with CSS3, you can use it in a backwards compatible way with legacy browsers. Details of how to implement relative fonts are slightly out of scope, but you can find out more here:
However, resizing text can lead to layout problems. Text might be pushed off screen, forcing the user to scroll, or text might bleed out of its container, potentially into other text, making parts of the webpage illegible. This where a responsive (or fluid) layout can help. "Responsive" sites are designed to adapt to whatever device they are being viewed on; as such they rarely use fixed pixels for height/width or font-size. Consequently, such sites usually behave well when font-sizes are changed: their layout doesn't break.
The WCAG guidelines recommend not only that text should be able to be enlarged by up to 200%, but also that the website can accommodate the increased text size. Responsive web design can aid that because:
However, it's important to note that responsive design and accessibility are not the same thing: although they may complement each other, they ultimately have different aims. A responsive site is not necessarily accessible, and vice versa.
The use of tables as aids in a page layout is (hopefully) a thing of the past. There are also accessibility-related ramifications for misusing tables. Tables are intended to represent data or information, and as such rows and columns have an inherent meaning, and screen readers assume this when reading out data.
A screen reader, for example, will read out the row and column number before reading out the contents of the cell. Since the cell position in tables used for purely presentational purposes is irrelevant, this information can be confusing, or at the very least irritating: the end user is being told there is some tabular structure, when really, there isn't.
Most theme developers won't need to produce tables (and the WordPress posts calendar is already accessible). However, plugins may display tables through shortcodes or widgets. There are number of things to be aware of when producing the table mark-up:
Where appropriate, provide a <caption>
element at the top of a table, describing what the table shows:
<table> <caption> ... </caption> ... </table>
<th>
for table headers and <td>
for table data. <th>
cells should never be empty.<th>
cells, indicating if it is a row or column header: <th scope="col">
or <th scope="row">
. Although the scope is often determined by the screen reader, it doesn't hurt to be explicit.<thead>
, <tbody>
and <tfoot>
, but they offer no benefits in terms of accessibility.Use the title
attribute of headings to explain an abbreviation used in the cell:
<table> <caption> February 2014 </caption> <thead> <tr> <th title="Monday" scope="col">M</th> <th title="Tuesday" scope="col">T</th> <th title="Wednesday" scope="col">W</th> <th title="Thursday" scope="col">T</th> <th title="Friday" scope="col">F</th> <th title="Saturday" scope="col">S</th> <th title="Sunday" scope="col">S</th> </tr> </thead> ... </table>
Accessible Rich Internet Applications (ARIA) attributes are useful in identifying the purpose of a particular part of the page, any properties (e.g. labelling a required form input as such) and state (e.g. labelling a button as disabled). Using them can help assistive technologies understand your website better, and so present your page more clearly to the end user. We'll be looking at ARIA in the next article in this series. Later on in the series, we'll also be looking at correct form mark-up, and accessible feedback.
The Best Small Business Web Designs by DesignRush
/Create Modern Vue Apps Using Create-Vue and Vite
/Pros and Cons of Using WordPress
/How to Fix the “There Has Been a Critical Error in Your Website” Error in WordPress
/How To Fix The “There Has Been A Critical Error in Your Website” Error in WordPress
/How to Create a Privacy Policy Page in WordPress
/How Long Does It Take to Learn JavaScript?
/The Best Way to Deep Copy an Object in JavaScript
/Adding and Removing Elements From Arrays in JavaScript
/Create a JavaScript AJAX Post Request: With and Without jQuery
/5 Real-Life Uses for the JavaScript reduce() Method
/How to Enable or Disable a Button With JavaScript: jQuery vs. Vanilla
/How to Enable or Disable a Button With JavaScript: jQuery vs Vanilla
/Confirm Yes or No With JavaScript
/How to Change the URL in JavaScript: Redirecting
/15+ Best WordPress Twitter Widgets
/27 Best Tab and Accordion Widget Plugins for WordPress (Free & Premium)
/21 Best Tab and Accordion Widget Plugins for WordPress (Free & Premium)
/30 HTML Best Practices for Beginners
/31 Best WordPress Calendar Plugins and Widgets (With 5 Free Plugins)
/25 Ridiculously Impressive HTML5 Canvas Experiments
/How to Implement Email Verification for New Members
/How to Create a Simple Web-Based Chat Application
/30 Popular WordPress User Interface Elements
/Top 18 Best Practices for Writing Super Readable Code
/Best Affiliate WooCommerce Plugins Compared
/18 Best WordPress Star Rating Plugins
/10+ Best WordPress Twitter Widgets
/20+ Best WordPress Booking and Reservation Plugins
/Working With Tables in React: Part Two
/Best CSS Animations and Effects on CodeCanyon
/30 CSS Best Practices for Beginners
/How to Create a Custom WordPress Plugin From Scratch
/10 Best Responsive HTML5 Sliders for Images and Text… and 3 Free Options
/16 Best Tab and Accordion Widget Plugins for WordPress
/18 Best WordPress Membership Plugins and 5 Free Plugins
/25 Best WooCommerce Plugins for Products, Pricing, Payments and More
/10 Best WordPress Twitter Widgets
1 /12 Best Contact Form PHP Scripts for 2020
/20 Popular WordPress User Interface Elements
/10 Best WordPress Star Rating Plugins
/12 Best CSS Animations on CodeCanyon
/12 Best WordPress Booking and Reservation Plugins
/12 Elegant CSS Pricing Tables for Your Latest Web Project
/24 Best WordPress Form Plugins for 2020
/14 Best PHP Event Calendar and Booking Scripts
/Create a Blog for Each Category or Department in Your WooCommerce Store
/8 Best WordPress Booking and Reservation Plugins
/Best Exit Popups for WordPress Compared
/Best Exit Popups for WordPress Compared
/11 Best Tab & Accordion WordPress Widgets & Plugins
/12 Best Tab & Accordion WordPress Widgets & Plugins
1 /New Course: Practical React Fundamentals
/Preview Our New Course on Angular Material
/Build Your Own CAPTCHA and Contact Form in PHP
/Object-Oriented PHP With Classes and Objects
/Best Practices for ARIA Implementation
/Accessible Apps: Barriers to Access and Getting Started With Accessibility
/Dramatically Speed Up Your React Front-End App Using Lazy Loading
/15 Best Modern JavaScript Admin Templates for React, Angular, and Vue.js
/15 Best Modern JavaScript Admin Templates for React, Angular and Vue.js
/19 Best JavaScript Admin Templates for React, Angular, and Vue.js
/New Course: Build an App With JavaScript and the MEAN Stack
/10 Best WordPress Facebook Widgets
13 /Hands-on With ARIA: Accessibility for eCommerce
/New eBooks Available for Subscribers
/Hands-on With ARIA: Homepage Elements and Standard Navigation
/Site Accessibility: Getting Started With ARIA
/How Secure Are Your JavaScript Open-Source Dependencies?
/New Course: Secure Your WordPress Site With SSL
/Testing Components in React Using Jest and Enzyme
/Testing Components in React Using Jest: The Basics
/15 Best PHP Event Calendar and Booking Scripts
/Create Interactive Gradient Animations Using Granim.js
/How to Build Complex, Large-Scale Vue.js Apps With Vuex
1 /Examples of Dependency Injection in PHP With Symfony Components
/Set Up Routing in PHP Applications Using the Symfony Routing Component
1 /A Beginner’s Guide to Regular Expressions in JavaScript
/Introduction to Popmotion: Custom Animation Scrubber
/Introduction to Popmotion: Pointers and Physics
/New Course: Connect to a Database With Laravel’s Eloquent ORM
/How to Create a Custom Settings Panel in WooCommerce
/Building the DOM faster: speculative parsing, async, defer and preload
1 /20 Useful PHP Scripts Available on CodeCanyon
3 /How to Find and Fix Poor Page Load Times With Raygun
/Introduction to the Stimulus Framework
/Single-Page React Applications With the React-Router and React-Transition-Group Modules
12 Best Contact Form PHP Scripts
1 /Getting Started With the Mojs Animation Library: The ShapeSwirl and Stagger Modules
/Getting Started With the Mojs Animation Library: The Shape Module
/Getting Started With the Mojs Animation Library: The HTML Module
/Project Management Considerations for Your WordPress Project
/8 Things That Make Jest the Best React Testing Framework
/Creating an Image Editor Using CamanJS: Layers, Blend Modes, and Events
/New Short Course: Code a Front-End App With GraphQL and React
/Creating an Image Editor Using CamanJS: Applying Basic Filters
/Creating an Image Editor Using CamanJS: Creating Custom Filters and Blend Modes
/Modern Web Scraping With BeautifulSoup and Selenium
/Challenge: Create a To-Do List in React
1 /Deploy PHP Web Applications Using Laravel Forge
/Getting Started With the Mojs Animation Library: The Burst Module
/10 Things Men Can Do to Support Women in Tech
/A Gentle Introduction to Higher-Order Components in React: Best Practices
/Challenge: Build a React Component
/A Gentle Introduction to HOC in React: Learn by Example
/A Gentle Introduction to Higher-Order Components in React
/Creating Pretty Popup Messages Using SweetAlert2
/Creating Stylish and Responsive Progress Bars Using ProgressBar.js
/How to Make a Real-Time Sports Application Using Node.js
/Creating a Blogging App Using Angular & MongoDB: Delete Post
/Set Up an OAuth2 Server Using Passport in Laravel
/Creating a Blogging App Using Angular & MongoDB: Edit Post
/Creating a Blogging App Using Angular & MongoDB: Add Post
/Introduction to Mocking in Python
/Creating a Blogging App Using Angular & MongoDB: Show Post
/Creating a Blogging App Using Angular & MongoDB: Home
/Creating a Blogging App Using Angular & MongoDB: Login
/Creating Your First Angular App: Implement Routing
/Persisted WordPress Admin Notices: Part 4
/Creating Your First Angular App: Components, Part 2
/Persisted WordPress Admin Notices: Part 3
/Creating Your First Angular App: Components, Part 1
/How Laravel Broadcasting Works
/Persisted WordPress Admin Notices: Part 2
/Create Your First Angular App: Storing and Accessing Data
/Persisted WordPress Admin Notices: Part 1
/Error and Performance Monitoring for Web & Mobile Apps Using Raygun
/Using Luxon for Date and Time in JavaScript
7 /How to Create an Audio Oscillator With the Web Audio API
/How to Cache Using Redis in Django Applications
/20 Essential WordPress Utilities to Manage Your Site
/Beginner’s Guide to Angular 4: HTTP
/Rapid Web Deployment for Laravel With GitHub, Linode, and RunCloud.io
/Beginners Guide to Angular 4: Routing
/Beginner’s Guide to Angular 4: Services
/Beginner’s Guide to Angular 4: Components
/Creating a Drop-Down Menu for Mobile Pages
/Introduction to Forms in Angular 4: Writing Custom Form Validators
/10 Best WordPress Booking & Reservation Plugins
/Getting Started With Redux: Connecting Redux With React
/Getting Started With Redux: Learn by Example
/Getting Started With Redux: Why Redux?
/Understanding Recursion With JavaScript
/How to Auto Update WordPress Salts
/How to Download Files in Python
/Eloquent Mutators and Accessors in Laravel
1 /10 Best HTML5 Sliders for Images and Text
/Creating a Task Manager App Using Ionic: Part 2
/Creating a Task Manager App Using Ionic: Part 1
/Introduction to Forms in Angular 4: Reactive Forms
/Introduction to Forms in Angular 4: Template-Driven Forms
/24 Essential WordPress Utilities to Manage Your Site
/25 Essential WordPress Utilities to Manage Your Site
/Get Rid of Bugs Quickly Using BugReplay
1 /Manipulating HTML5 Canvas Using Konva: Part 1, Getting Started
/10 Must-See Easy Digital Downloads Extensions for Your WordPress Site
/22 Best WordPress Booking and Reservation Plugins
/Understanding ExpressJS Routing
/15 Best WordPress Star Rating Plugins
/Creating Your First Angular App: Basics
/Inheritance and Extending Objects With JavaScript
/Introduction to the CSS Grid Layout With Examples
1Performant Animations Using KUTE.js: Part 5, Easing Functions and Attributes
Performant Animations Using KUTE.js: Part 4, Animating Text
/Performant Animations Using KUTE.js: Part 3, Animating SVG
/New Course: Code a Quiz App With Vue.js
/Performant Animations Using KUTE.js: Part 2, Animating CSS Properties
Performant Animations Using KUTE.js: Part 1, Getting Started
/10 Best Responsive HTML5 Sliders for Images and Text (Plus 3 Free Options)
/Single-Page Applications With ngRoute and ngAnimate in AngularJS
/Deferring Tasks in Laravel Using Queues
/Site Authentication in Node.js: User Signup and Login
/Working With Tables in React, Part Two
/Working With Tables in React, Part One
/How to Set Up a Scalable, E-Commerce-Ready WordPress Site Using ClusterCS
/New Course on WordPress Conditional Tags
/TypeScript for Beginners, Part 5: Generics
/Building With Vue.js 2 and Firebase
6 /Best Unique Bootstrap JavaScript Plugins
/Essential JavaScript Libraries and Frameworks You Should Know About
/Vue.js Crash Course: Create a Simple Blog Using Vue.js
/Build a React App With a Laravel RESTful Back End: Part 1, Laravel 5.5 API
/API Authentication With Node.js
/Beginner’s Guide to Angular: Routing
/Beginners Guide to Angular: Routing
/Beginner’s Guide to Angular: Services
/Beginner’s Guide to Angular: Components
/How to Create a Custom Authentication Guard in Laravel
/Learn Computer Science With JavaScript: Part 3, Loops
/Build Web Applications Using Node.js
/Learn Computer Science With JavaScript: Part 4, Functions
/Learn Computer Science With JavaScript: Part 2, Conditionals
/Create Interactive Charts Using Plotly.js, Part 5: Pie and Gauge Charts
/Create Interactive Charts Using Plotly.js, Part 4: Bubble and Dot Charts
/Create Interactive Charts Using Plotly.js, Part 3: Bar Charts
/Awesome JavaScript Libraries and Frameworks You Should Know About
/Create Interactive Charts Using Plotly.js, Part 2: Line Charts
/Bulk Import a CSV File Into MongoDB Using Mongoose With Node.js
/Build a To-Do API With Node, Express, and MongoDB
/Getting Started With End-to-End Testing in Angular Using Protractor
/TypeScript for Beginners, Part 4: Classes
/Object-Oriented Programming With JavaScript
/10 Best Affiliate WooCommerce Plugins Compared
/Stateful vs. Stateless Functional Components in React
/Make Your JavaScript Code Robust With Flow
/Build a To-Do API With Node and Restify
/Testing Components in Angular Using Jasmine: Part 2, Services
/Testing Components in Angular Using Jasmine: Part 1
/Creating a Blogging App Using React, Part 6: Tags
/React Crash Course for Beginners, Part 3
/React Crash Course for Beginners, Part 2
/React Crash Course for Beginners, Part 1
/Set Up a React Environment, Part 4
1 /Set Up a React Environment, Part 3
/New Course: Get Started With Phoenix
/Set Up a React Environment, Part 2
/Set Up a React Environment, Part 1
/Command Line Basics and Useful Tricks With the Terminal
/How to Create a Real-Time Feed Using Phoenix and React
/Build a React App With a Laravel Back End: Part 2, React
/Build a React App With a Laravel RESTful Back End: Part 1, Laravel 9 API
/Creating a Blogging App Using React, Part 5: Profile Page
/Pagination in CodeIgniter: The Complete Guide
/JavaScript-Based Animations Using Anime.js, Part 4: Callbacks, Easings, and SVG
/JavaScript-Based Animations Using Anime.js, Part 3: Values, Timeline, and Playback
/Learn to Code With JavaScript: Part 1, The Basics
/10 Elegant CSS Pricing Tables for Your Latest Web Project
/Getting Started With the Flux Architecture in React
/Getting Started With Matter.js: The Composites and Composite Modules
Getting Started With Matter.js: The Engine and World Modules
/10 More Popular HTML5 Projects for You to Use and Study
/Understand the Basics of Laravel Middleware
/Iterating Fast With Django & Heroku
/Creating a Blogging App Using React, Part 4: Update & Delete Posts
/Creating a jQuery Plugin for Long Shadow Design
/How to Register & Use Laravel Service Providers
2 /Unit Testing in React: Shallow vs. Static Testing
/Creating a Blogging App Using React, Part 3: Add & Display Post
/Creating a Blogging App Using React, Part 2: User Sign-Up
20 /Creating a Blogging App Using React, Part 1: User Sign-In
/Creating a Grocery List Manager Using Angular, Part 2: Managing Items
/9 Elegant CSS Pricing Tables for Your Latest Web Project
/Angular vs. React: 7 Key Features Compared
/Creating a Grocery List Manager Using Angular, Part 1: Add & Display Items
New eBooks Available for Subscribers in June 2017
/Create Interactive Charts Using Plotly.js, Part 1: Getting Started
/The 5 Best IDEs for WordPress Development (And Why)
/33 Popular WordPress User Interface Elements
/New Course: How to Hack Your Own App
/How to Install Yii on Windows or a Mac
/What Is a JavaScript Operator?
/How to Register and Use Laravel Service Providers
/
waly Good blog post. I absolutely love this…