A few months ago I came across a media query for Reduced Motion in CSS. Some users may find some animated motions on websites can make them feel ill. These users can switch on the Reduced Motion setting in their operating system to try and limit these motions.
As web developers we can help by using CSS (and javaScript) to respect that setting.
CSS Media Query for Reduced Motion
Within the media query you can add settings to prevent transitions or animation from happening.
You can even add a wildcard rules so that any transitions or transforms and animations are prevented as I have in the code below.
/* Tone down the animation to avoid vestibular motion triggers like scaling or panning large objects. */
@media (prefers-reduced-motion: reduce) {
html {
scroll-behavior: auto; // override smooth scrolling
}
* {
transition: none !important;
animation: none !important;
transform: none !Important;
}
}
Pitfalls
You may find the wildcard approach may disable some transitions or transforms or animations you want to keep so you may have to add some overrides when using that approach or use the css :not notation to ignore certain classes or elements.
/* Tone down the animation to avoid vestibular motion triggers like scaling or panning large objects. */
@media (prefers-reduced-motion: reduce) {
html {
scroll-behavior: auto; // override smooth scrolling
}
* {
transition: none !important;
animation: none !important;
}
// this ignores the elements and classes specified but targets everything else.
*:not(path, text, g, polyline, rect, svg, clipPath, image, .svg, .mapholder, use) {
transform: none !Important;
}
}
JavaScript Respect Reduced Motion
For JavaScript you can use the following code to check if the user has reduced motion set. Then test the matches – if it returns true then the user has reduced motion set.
var mediaQuery = window.matchMedia('(prefers-reduced-motion: reduce)');
if(mediaQuery.matches) {
$('#'+defid).toggle(); // show and hide rather than...
} else {
$('#'+defid).slideToggle(); // sliding up and down
}
Some notes, interesting quotes, videos and useful links for accessibility on the web and in apps that I’m noting down as I learn more about Accessibility.
Making the web and apps accessible can benefit more than just users with disabilities. It can help all users by making content easier to understand, easier to read, clearer and easier to access where connectivity is a problem.
As an example one of the first Typewriters was invented to help Pellegrino Turri’s blind friend to write more legibly.
The web and accessibility standards are constantly evolving and growing so we need to keep reviewing and improving our UX constantly. People also need to be continually trained on how to create accessible content. We all have a corporate social responsibility to make the web and apps accessible as well as a legal one. Accessibility is a human right.
Perceivable
Content should be presentable in different ways so it can be perceived by all users.
Operable
Websites and apps should be operable by all users regardless of disability
Understandable
Content should be understandable for all users.
Robust
Website, Apps and their content should be interpreted reliably by a variety of different devices.
For example do we really need 22 different buttons styles, when one or two would do?
Pattern Libraries can be useful in mitigating this across teams so team members can refer back to the reference.
“Interfaces that break too many rules may win design awards, but they’ll also alienate users. As a rule of thumb, users should be able to look at any part of your interface and think, “I’ve seen something like this before”. Not exactly like it, but like it.”
Videos should have closed captions for both blind and deaf users. Audio Descriptions can also be useful in making the videos understandable to blind or partially sighted users. Captions can be read out by screen readers so blind users can also follow along as well.
Captions are synchronised with the video content so they appear at the right time for users who can’t hear the spoken words or have trouble understanding what has been said.
YouTube will automatically create Closed Captions for you, but you should review these before publishing as they won’t be 100% accurate and may have some hilariously wrong translations in there. e.g. YouTube cannot translate the name of our college Dumfries and Galloway College.
Transcripts are optional for videos whereas captions are required. They can be useful for users who don’t want to watch the video and would rather have it read out to them.
They are essential for Audio only files such as Podcasts.
Signlanguage
Sign language can also be used on videos so a deaf user who knows sign language can follow the content. They can create a richer experience for deaf users whose first language may be sign language.
Alternative Text
Images and multimedia such as charts should have alternative text so that they can be read by Screen Readers or converted to brail and be understood by blind or partially sighted users. This is especially important where the image or non text media is used to impart information.
This text will depend a lot on context. For instance if you had a picture of a woman wearing a blue shirt and the context was a shopping website selling blue shirts you probably want the image alt text to mention that the woman is wearing a blue shirt and describe that shirt.
If the image has text in it that is readable you should reproduce this text in the alt tag as well.
Alt text should be succinct and understandable to the user.
Any empty alt tag indicates that the image is decorative and can be ignored this is not the same as a missing alt tag. You can also use aria-hidden=”true” but be aware that not every device will recognise this.
<img src="example.jpg" alt="A young woman in a floaty pale blue shirt" />
<img src="decorative.png" alt="" aria-hidden="true" />
Responsive websites can also help users when using zoom to resize the text on their screen to make it larger or smaller if they are coded correctly.
One size does not fit all!
Don’t assume that larger text is more accessible than small text. For some users this is not the case. Users with tunnel vision may actually prefer small text with tight linespacing because they can read more of the words at once making reading quicker and easier for them. This is why being able to adjust the text on the screen can be useful. Your web page should support adjusting text size so that text does not overlap when font size is increased. Avoiding fixed dimensions and using %’s, ems and rems rather than px or pt can help with this.
Target Size
Larger buttons, links an checkboxes with spacing around them are easier to hit or tap particularly by users who have poor motor control or tremors.
Colour Contrast
Colour contrast between textual information and its background should have a decent contrast so it is clear to the reader. Where colour is used as an indicator there should also be an alternative indicator for the colourblind so the differences are clear. E.g. underlines under text links.
“Colour (color) blindness (colour vision deficiency, or CVD) affects approximately 1 in 12 men (8%) and 1 in 200 women in the world. In Britain this means that there are approximately 3 million colour blind people (about 4.5% of the entire population), most of whom are male.”
“The contrast ratio should be at least 4.5:1 and ideally 7:1 for text. For graphical objects, such as charts, and for large text, a contrast ratio of 3:1 may be sufficient.”
Being able to easily disable audio in order to hear the output of a screen reader is a must.
Dark Modes / Light Modes
Having this option can help reduce glare or eyestrain. Some users may find content is easier to read by changing the setting to either dark mode or light mode.
Assistive Technologies
“Assistive Technologies refer to hardware or software that enable people with disabilities to interact and engage with the digital environment e.g. using a screen reader or a switch control.”
“Adaptive Strategies are techniques that people with disabilities use to interact with the digital environment such as adjusting platform and browser settings or resizing browser windows.”
These are used to help blind or low vision users to understand video content. They can also be useful to users with cognitive disabilities or users who are in noisy or quiet environments. They can also be used to help support children learning how to read.
Switch Inputs
These include:
Sip-and-puff switches which are triggered by sipping and puffing into a straw which then mimics tabbing and clicking.
Button switches which can be activated using the hand, foot or head. These can be single switches or multiple switches.
Camera switches which can be activated when tilting the head into a camera. Some mobile phones have this built into the accessibility settings.
Eye tracking, the process of measuring either the point of gaze (where one is looking) or the motion of an eye relative to the head.
Navigating by Keyboard or Switches
Links and Buttons should use standard HTML elements like <a> or <button> – this also applies for inputs and select fields.
Links and buttons should be labelled appropriately
links, buttons and inputs should be selectable and focusable using a keyboard.
Links and buttons should show when focus is on them using colour and another visual indicator.
Links and Buttons should follow a logical focus order. Left to right Top to bottom.
Table of the standard keystrokes:
Interaction
Keystrokes
Navigate to most elements
TabShift + Tab – navigate backward
Link
Enter
Button
Enter or Spacebar
Checkbox
Spacebar – check/uncheck a checkbox
Radio buttons
↑/↓ or ←/→ – select an optionTab – move to the next element
Select (dropdown) menu
↑/↓ – navigate between menu optionsSpacebar – expand
Autocomplete
Type to begin filtering↑/↓ – navigate to an optionEnter – select an option
Dialog
Esc – close
Slider
↑/↓ or ←/→ – increase or decrease slider valueHome/End – beginning or end
Menu bar
↑/↓ – Previous/next menu optionEnter – expand the menu (optional) and select an option.←/→ – expand/collapse submenu
Tab panel
Tab – once to navigate into the group of tabs and once to navigate out of the group of tabs↑/↓ or ←/→ – previous/next tab.
‘Tree’ menu
↑/↓ – Navigate Previous/next menu option←/→ – expand/collapse submenu, move up/down one level
Common screen readers include Jaws for Windows, NVDA for Windows, Narrator bundled with Windows, VoiceOver bundled with MacOS and iOS, and TalkBack bundled with Android.
Content should be laid out in a structured way
Headings should follow a standard hierarchical order
Skip to Content links should be included
Links should have understandable labels not just “Click Here”
Remember : Not all Screen Reader users are blind. Some are partially sighted, some may have cognitive difficulties with reading text, some may be audio learners, some may may just want to listen to text being read out while they do other things.
How to Navigate your iPhone or iPad with VoiceOver (Apple Support)
Using Voice Over Example
1. Switch VO on and off
To switch on VoiceOver go to Settings → General → Accessibility → VoiceOver then activate the VoiceOver ‘on’ switch to enable it.
2. Map the accessibility shortcut key
Before you start navigating, please set up the Accessibility shortcut menu. It is recommended you do this as it makes testing a lot quicker and easier as you don’t have to go into settings each time to switch VoiceOver on and off. Once set up, you are able to switch the accessibility features on and off using triple click on the side button (home button for older devices).
To enable this go to Settings → General → Accessibility → Accessibility Shortcuts and select VoiceOver and Zoom from the list of options. When you want to switch VoiceOver or Zoom on and off quickly, all you need do is triple click the side or home button to activate the menu to select VoiceOver or Zoom.
3. Complete the VoiceOver tutorial
Using the gestures below complete the VoiceOver tutorial. To do this go to Settings → General → Accessibility → VoiceOver, turn VoiceOver ‘on’ and select VoiceOver Practice.
Explore by touch: drag your finger over the screen to have VoiceOver describe the items under your finger. You can tap with a second finger or double-tap to open links, press buttons, and so on.
Gesture navigation: swipe right with a single finger to move from one item to the next in sequence, swipe left to go backward through this sequence. VoiceOver describes items as you move focus around the screen.
Announce an element: single tap sets focus on an element so it is announced.
Activate an element: double-tap a single finger to open links, press buttons, and navigate using the Rotor.
Open the Rotor: turn a dial with two fingers to open the Rotor. Drag your finger around the dial to choose headings from the list of items.
Jump between element: swipe up and down to jump between headings.
Screen curtain: with three fingers, quickly triple-tap the screen to turn it on and off. If the Zoom feature is in use with VoiceOver, tap the screen four times with three fingers.
Assistive Tech: TalkBack on Android
Digital Braille Display
Users who are blind and read braille may combine a screen reader with a hardware called a refreshable braille display. This sits next to the keyboard and is made up of hundreds of pins that move to create the braille. There are also smaller, portable, Bluetooth braille displays that can connect to mobiles and tablets, and be used on the move.
Allows users who are blind and deaf to read text on the web or blind users to read text quietly.
Content should be laid out in a structured way
Headings should follow a standard hierarchical order
Links should have understandable labels not just “Click Here”
Skip to Content links should be included
Speech to Text / Voice Over
Allows users to navigate and interact with the web using their voice. This helps users with limited dexterity or muscular control limitations, paralysis or missing limbs.
Links and Buttons should use standard HTML elements like <a> or <button> – this also applies for inputs and select fields.
Links and buttons should be labelled appropriately
links, buttons and inputs should be selectable and focusable using only voice.
Links and buttons should show when focus is on them using colour and another visual indicator.
Inputs option to be speech activated so text can be inputted by speaking.
Authoring Tool Accessibility Guidelines (ATAG) defines requirements on how to make the authoring tools themselves accessible, so that people with disabilities can create web content. It also defines requirements how authors can create accessible web content and conform to WCAG
User Agent Accessibility Guidelines (UAAG) provides guidance on how to make user agents accessible to people with disabilities. User agents include browsers, browser extensions, media players, readers and other applications that render web content