--- title: Мобильная доступность slug: Learn/Accessibility/Mobile tags: - Mobile translation_of: Learn/Accessibility/Mobile original_slug: Learn/Доступность/Mobile ---
With web access on mobile devices being so popular, and popular platforms such as iOS and Android having fully fledged accessibility tools, it is important to consider the accessibility of your web content on these platforms. This article looks at mobile-specific accessibility considerations.
Prerequisites: | Basic computer literacy, a basic understanding of HTML, CSS, and JavaScript, and an understanding of the previous articles in the course. |
---|---|
Objective: | To understand what problems exist with accessibility on mobile devices, and how to overcome them. |
The state of accessibility — and support for web standards in general — is good in modern mobile devices. Long gone are the days when mobile devices ran completely different web technologies to desktop browsers, forcing developers to use browser sniffing and serve them completely separate sites (although quite a few companies still detect usage of mobile devices and serve them a separate mobile domain).
These days, mobile devices in general can handle "full fat" websites, and the main platforms even have screenreaders built in to enable visually impaired users to use them successfully. Modern mobile browsers tend to have good support for WAI-ARIA, too.
To make a website accessible and usable on mobile, you just need to follow general good web design and accessibility best practices.
There are some exceptions that need special consideration for mobile; the main ones are:
The most common mobile platforms have fully functional screenreaders. These function in much the same way as desktop screenreaders, except they are largely operated using touch gestures rather than key combinations.
Let's look at the main two: TalkBack on Android and VoiceOver on iOS.
The TalkBack screenreader is built into the Android operating system.
To turn it on, select Settings > Accessibility > TalkBack, and then press the slider switch to turn it on. Follow any additional on-screen prompts that you are presented with.
Note: Older versions of TalkBack are turned on in slightly different ways.
When TalkBack is turned on, your Android device's basic controls will be a bit different. For example:
If you want to turn TalkBack off:
Note: You can get to your homescreen at any time by swiping up and left in a smooth motion. If you have more than one homescreen, you can move between them by swiping two fingers left and right.
For a more complete list of TalkBack gestures, see Use TalkBack gestures.
When TalkBack is turned on, unlocking the phone is a bit different.
You can do a two-finger swipe up from the bottom of the lock screen. If you've set a passcode or pattern for unlocking your device, you will then be taken to the relevant entry screen to enter it.
You can also explore by touch to find the Unlock button at the bottom middle of the screen, and then double-tap.
TalkBack allows you to access global and local context menus, wherever you have navigated to on the device. The former provides global options relating to the device as a whole, and the latter provides options relating just to the current app/screen you are in.
To get to these menus:
For details on all the options available under the global and local context menus, see Use global and local context menus.
You can use the local context menu while in a web browser to find options to navigate web pages using just the headings, form controls, or links, or navigate line by line, etc.
For example, with TalkBack turned on:
Note: See Get started on Android with TalkBack for more complete documentation.
A mobile version of VoiceOver is built into the iOS operating system.
To turn it on, go to Your Settings app and select General > Accessibility > VoiceOver. Press the VoiceOver slider to enable it (you'll also see a number of other options related to VoiceOver on this page).
Once VoiceOver is enabled, the iOS's basic control gestures will be a bit different:
To turn it off again, navigate back to Settings > General > Accessibility > VoiceOver using the above gestures, and toggle the VoiceOver slider back to off.
To unlock the phone, you need to press the home button (or swipe) as normal. If you have a passcode set, you can select each number by swiping/sliding (as explained above) and then double-tapping to enter each number when you've found the right one.
When VoiceOver is turned on, you have a navigation feature called the Rotor available to you, which allows you to quickly choose from a number of common useful options. To use it:
The options available under the Rotor are context-sensitive — they will differ depending on what app or view you are in (see below for an example).
Let's have a go at web browsing with VoiceOver:
Note: For a more complete reference covering the VoiceOver gestures available and other hints on accessibility testing on iOS, see Test Accessibility on Your Device with VoiceOver.
In our CSS and JavaScript accessibility article, we looked at the idea of events that are specific to a certain type of control mechanism (see Mouse-specific events). To recap, these cause accessibility issues because other control mechanisms can't activate the associated functionality.
As an example, the click event is good in terms of accessibility — an associated event handler can be invoked by clicking the element the handler is set on, tabbing to it and pressing Enter/Return, or tapping it on a touchscreen device. Try our simple-button-example.html example (see it running live) to see what we mean.
Alternatively, mouse-specific events such as mousedown and mouseup create problems — their event handlers cannot be invoked using non-mouse controls.
If you try to control our simple-box-drag.html (see example live) example with keyboard or touch, you'll see the problem. This occurs because we are using code such as the following:
div.onmousedown = function() {
initialBoxX = div.offsetLeft;
initialBoxY = div.offsetTop;
movePanel();
}
document.onmouseup = stopMove;
To enable other forms of control, you need to use different, yet equivalent events — for example, touch events work on touchscreen devices:
div.ontouchstart = function(e) {
initialBoxX = div.offsetLeft;
initialBoxY = div.offsetTop;
positionHandler(e);
movePanel();
}
panel.ontouchend = stopMove;
We've provided a simple example that shows how to use the mouse and touch events together — see multi-control-box-drag.html (see the example live also).
Note: You can also see fully functional examples showing how to implement different control mechanisms at Implementing game control mechanisms.
Responsive design is the practice of making your layouts and other features of your apps dynamically change depending on factors such as screen size and resolution, so they are usable and accessible to users of different device types.
In particular, the most common problems that need to be addressed for mobile are:
Note: We won't provide a full discussion of responsive design techniques here, as they are covered in other places around MDN (see above links).
There are other important issues to consider when making sites more accessible on mobile. We have listed a couple here, but we will add more when we think of them.
Using viewport, it is possible to disable zoom, using code like this in your {{htmlelement("head")}}:
<meta name="viewport" content="user-scalable=no">
You should never do this if at all possible — many people rely on zoom to be able to see the content of your website, so taking this functionality away is a really bad idea. There are certain situations where zooming might break the UI; in such cases, if you feel that you absolutely need to disable zoom, you should provide some other kind of equivalent, such as a control for increasing the text size in a way that doesn't break your UI.
Because the screen is so much narrower on mobile devices, it is very common to use media queries and other technologies to make the navigation menu shrink down to a tiny icon at the top of the display — which can be pressed to reveal the menu only if it's needed — when the site is viewed on mobile. This is commonly represented by a "three horizontal lines" icon, and the design pattern is consequently known as a "hamburger menu".
When implementing such a menu, you need to make sure that the control to reveal it is accessible by appropriate control mechanisms (normally touch for mobile), as discussed in {{anch("Control mechanisms")}} above, and that the rest of the page is moved out of the way or hidden in some way while the menu is being accessed, to avoid confusion with navigating it.
Click here for a good hamburger menu example.
On mobile devices, inputting data tends to be more annoying for users than the equivalent experience on desktop computers. It is more convenient to type text into form inputs using a desktop or laptop keyboard than a touchscreen virtual keyboard or a tiny mobile physical keyboard.
For this reason, it is worth trying to minimize the amount of typing needed. As an example, instead of getting users to fill out their job title each time using a regular text input, you could instead offer a {{htmlelement("select")}} menu containing the most common options (which also helps with consistency in data entry), and offer an "Other" option that displays a text field to type any outliers into. You can see a simple example of this idea in action in common-job-types.html (see the common jobs example live).
It is also worth considering the use of HTML5 form input types such as date on mobile platforms as they handle them well — both Android and iOS, for example, display usable widgets that fit well with the device experience. See html5-form-examples.html for some examples (see the HTML5 form examples live) — try loading these and manipulating them on mobile devices. For example:
number
, tel
, and email
display suitable virtual keyboards for entering numbers/telephone numbers.time
and date
display suitable pickers for selecting times and dates.If you want to provide a different solution for desktops, you could always serve different markup to your mobile devices using feature detection. See input types for raw information on detecting different input types, and also check out our feature detection article for much more information.
In this article we have provided you with some details about common mobile accessibility-specific issues and how to overcome them. We also took you through usage of the most common screenreaders to aid you in accessibility testing.