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 loaded, with no warning or only a banner a screen reader never reads, and everything typed into the form 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.

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. In Broken 2, try reaching the warning with Tab, and read what a screen reader would say.

Broken Can you fix this?

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

Delivery details

Screen reader says:

(Skip ahead to 2 minutes before the limit)

A recreated demo. The broken version is intentionally inaccessible.

03

The fix

Let the session outlast the visit, or warn people before it ends in a dialog they meet at once, and let one press keep them signed in.

  1. 1Make every time limit longer than 20 hours, let people turn it off, or warn them before it ends.
  2. 2Where a limit stays, warn at least 20 seconds before the end, and let one action extend it, as often as people need.
  3. 3Put the warning where focus is, so it is seen, read out and reached first.
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 } }));
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));

Fixing this with an AI coding assistant? Get this guide as Markdown, or get every guide in your coding agent.

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.

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, is a topic of its own. Telling people how long they can be idle before they lose data, and designing a process 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.

Keep this fixed as your code changes.

Turn guides like this into rules your coding agents and CI follow, then have the result retested with a keyboard and screen readers.

How retests work