Skip to content
easeweb
Search topics

Session timeouts with no warning or way to extend

A checkout signs people out 15 minutes after the page loads, with no warning or one a screen reader never reads, and everything typed is lost.

WCAG 2.2
SC 2.2.1A
Required by
Section 508 · EN 301 549 (EU)
Broken setTimeout(signOut, 15 * 60 * 1000)
The accessibility problem illustrated: Motor:I was still typing. Where did it go?
01

The problem

People who type, read or move more slowly are signed out in the middle of checkout and lose what they entered, with no warning they can perceive and no way to ask for more time

02

Try it

Edit the gift message, then skip ahead and see what the shop does before its 15-minute limit

  • Broken 1: the demo clock above the window stands in for the minutes; it is not part of the shop, and typing doesn’t reset it, just as typing sends nothing to the server. The last two minutes run in real time. Is there any warning before the limit? Sign in again: what is left of your gift message?

  • Broken 2: when the warning appears, try reaching it with Tab, and read what a screen reader would say.

  • Apply a fix. Skip ahead again. Can you carry on without losing your gift message?

Broken Can you fix this?

Demo clock: 0:00 since the shop last heard from you
Fernbrook Signed in as Alex

Delivery details

A recreated demo. The broken version is intentionally inaccessible.

03

The fix

Let the session outlast the visit, or extend with one press

Before

A session that signs out with no warning

// A session ends 15 minutes after the last request.app.use(session({ secret: process.env.SESSION_SECRET, rolling: true, cookie: { maxAge: 15 * 60 * 1000 } }));
What is wrong3 points
  • People are signed out in the middle of the form. The page signs them out 15 minutes after it loaded, with no warning, whatever they are doing.
  • People who need more time can't get it. Nothing lets them turn the limit off, lengthen it or ask for more time.
  • Everything typed is lost. The form's contents go with the page.
After

A warning dialog that keeps people signed in

// The same 15-minute session, renewed by any request.app.use(session({ secret: process.env.SESSION_SECRET, rolling: true, cookie: { maxAge: 15 * 60 * 1000 } }));app.post('/session/extend', (req, res) => res.sendStatus(204));
How it is fixed3 steps
  1. Write the warning as a dialog with role="alertdialog", named by its title and described by its text: the time left, and what will be lost.
  2. Two minutes before the end, open it with showModal(). It opens over the page and moves focus to Stay signed in, so a screen reader can read the title, the time left and the button, a magnifier follows focus to it, and a keyboard user is already on it.
  3. When it closes, by Stay signed in or Escape, renew the session on the server and start the page's clock again, as many times as people need. The browser puts focus back where it was, so people carry on typing.

This fixes both Befores and passes 2.2.1. The limit stays, but nobody meets it unawares. If nobody answers, the session ends as before, which is what the limit is for on a shared computer.

04

Verify the fix

5 checks, no mouse.

Test with: Keyboard, Screen reader, Zoom

0 of 5 checked

Record the OS, browser and assistive-technology versions, the build, the date, and the actual result of each step. Repeat after the session settings, the sign-in flow or the warning change.

How screen readers handle aria-describedby and <dialog>

Limits

This covers time limits that end a session or a page, and one way of warning about them. Content that moves, scrolls or updates by itself has its own criterion and guide: tickers, carousels and animations that can't be paused. A message that disappears on a timer is a 2.2.1 limit too, with its own guide: toasts that vanish before you can read or undo them. A page that reloads or redirects itself on a timer, as a delayed meta refresh does, has its own guide: pages that reload or redirect themselves on a timer. Telling people how long they can be idle before they lose data, and designing a checkout with no timing at all, are AAA topics of their own. Whether a limit is really essential or part of a real-time event is a judgement only the people who run the service can make, and screen readers handle dialogs that open by themselves differently: test the warning with the ones your users have.

This is a recreated teaching example, not a finding about a named client. The code is a starting pattern: test it in your own product. No completed assistive-technology test is claimed here.

EaseWeb service

Fixed it? Keep it from coming back.

I turn guides like this one into rules your coding agents follow and checks your CI runs. Then I retest by hand with a keyboard and screen readers, periodically.

See the service