Mobile Accessibility Guidelines - Scripts & dynamic content

Timeouts must


A timed response must be adjustable.


Some people may not be able to respond or interact before a time limit is reached. If a timeout is essential, allow users to extend, change or disable the time limit to ensure they can still access content, complete forms, and make choices at their own speed.

For example, as appropriate for the content:

  • provide a means to adjust or disable a timing feature before starting an interaction,
  • warn the user of a timeout and provide a means to extend the time.

An exception may be made, with sought advice, for real-time content and content that would be invalidated by allowing more time, such as a quiz or vote.


iOS

Provide a UIAlertView to allow the user to extend the time required at least 20 seconds before the application times out.

iOS Example (Objective-C)

UIAlertView *messageBox = [[UIAlertView alloc] initWithTitle: NSLocalizedString(@"Warning") message: NSLocalizedString(@"Your session will end in 20 seconds. Press OK to continue.") delegate:nil cancelButtonTitle: NSLocalizedString(@"OK") otherButtonTitles:nil];
[messageBox show];

Android

Provide a AlertDialog to allow the user to extend the time required at least 20 seconds before the application times out.

Android Pass Example

lertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("Warning");
builder.setMessage("Your session will end in 20 seconds. Press OK to continue.");
builder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
  dialog.cancel();
  }
});
AlertDialog alert = builder.create();
alert.show();

HTML

Use the JavaScript setTimeout method to set the time limit, and use the confirm function to allow the user to extend the time required at least 20 seconds before the application times out.

HTML Pass Example

<head>
  <script>
  var sessionTime;
  function setTimer() {
    // [N] = the session time in seconds, less twenty seconds.
    sessionTime = setTimeout("displayTimeoutAlert()", [N]);
  }
  function displayTimeoutAlert() {
    var sessionChoice = confirm("Your session is about to expire. Do you require more time?")
    if (sessionChoice == true) {
      sessionTime = setTimeout("displayTimeoutAlert()", [N]);
    } else {
      alert("Your session has ended. Please log in again.");
    }
  }
  </script>
</head>
<body onload="setTimer();">
  鈥�
</body>

Testing

Procedures

  1. Activate the app.
  2. Determine if the app contains a form or activity that must be completed within a given amount of time.
  3. Verify that the app allows the user to do one of the following:
    • disable the timeout before it occurs,
    • extend the length of the current session,
    • increase the time limit.
  4. Verify that the user is warned at least 20 seconds prior to the timeout.
  5. Verify that the user is warned if any data entered during the session will be deleted upon session timeout.
  6. Verify that the user can renew or extend the session using an alternative input method.

Outcome

One of the following checks is true:

When a form or activity has a time limit:

  • The timeout can be disabled by the user;
  • A mechanism exists whereby the user can request more time to complete the form/activity;
  • The user can modify the session to extend the amount of time before timeout.