Providing a script that warns the user a time limit is about to expire and provides a way to extend it

Important Information about Techniques

See Understanding Techniques for WCAG Success Criteria for important information about the usage of these informative techniques and how they relate to the normative WCAG 2.1 success criteria. The Applicability section explains the scope of the technique, and the presence of techniques for a specific technology does not imply that the technology can be used in all situations to create content that meets WCAG 2.1.



Adobe has plans to stop updating and distributing the Flash Player at the end of 2020, and encourages authors interested in creating accessible web content to use HTML.

This technique relates to Success Criterion 2.2.1: Timing Adjustable (Sufficient).


The objective of this technique is to notify users that they are almost out of time to complete an interaction. When scripts provide functionality that has time limits, the script can include functionality to warn the user of imminent time limits and provide a mechanism to request more time. 20 seconds or more before the time limit occurs, the script provides a confirm dialog that states that a time limit is imminent and asks if the user needs more time. If the user answers "yes" then the time limit is reset. If the user answers "no" or does not respond, the time limit is allowed to expire.

This technique involves time limits set with the setTimeout() method. If, for example, the time limit should be 60 seconds, you can set the time limit for 40 seconds (20 seconds less than the desired timeout) and show a confirm dialog. The confirm dialog sets a new timeout for the remaining 20 seconds. If the user requests more time, a new timeout is set. However, if the 20-second "grace period time limit" expires (meaning 60 seconds have now elapsed), the action appropriate for the expiry of the 60 second time limit in the original design is taken.


Example 1: Using ActionScript to offer a time limit extension before the timeout expires

This is a basic AS2 example of a time limit that can be extended by the user. An alert is shown after 40 seconds of inactivity, warning that the session is about to expire. The user is given 20 seconds to press the space bar or click on the "Yes" button. Note that the 40 second duration would be insufficient for most tasks and is artificially short for ease of demonstration.

import mx.controls.Alert;
import flash.accessibility.Accessibility;


var sessionTimeout;
var sessionNotificationTimeout;
var timeLimit: Number = 60000;
var sessionAlert: Alert;

testField.addEventListener("change", resetTimeout);

function resetTimeout() {
  sessionTimeout = setTimeout(endSession, timeLimit);
  sessionNotificationTimeout = setTimeout(showTimeoutAlert, timeLimit - 20000);

function showTimeoutAlert() {
  sessionAlert ="Click the YES button to extend your session",
  "Your login session is about to expire, do you need more time?",
  Alert.YES | Alert.NO, null, handleAlertClick);

function endSession() {
  sessionAlert.deletePopUp();"please log in again",
  "Your session has expired");

function handleAlertClick(e) {
  if (e && e.detail && e.detail == Alert.YES)

For a demonstration, see a working example of Using ActionScript to offer a time limit extension before the timeout expires. The source of Using ActionScript to offer a time limit extension before the timeout expires is available.



  1. load the page and start a timer that is 20 seconds less than the time limit.
  2. when the timer expires, check that a confirmation dialog is displayed warning of the impending time limit and allows the user to extend the limit within 20 seconds.

Expected Results

Check #2 is true