Skip to content
easeweb
Search topics

Session timeouts that bring you back to an empty form

A claim form signs people out after 30 minutes without a request, nothing on it says so, and signing in again brings back the form with everything typed gone.

WCAG 2.2
SC 2.2.6AAA· new in 2.1SC 2.2.5AAA
Required by
Not required by Section 508 or EN 301 549
Broken res.redirect('/sign-in')
The accessibility problem illustrated: Cognitive:I signed in again. Where did my claim go?
01

The problem

People who need longer to fill in a form are signed out without knowing there was a limit, and lose everything they wrote when they sign in again

02

Try it

Leave the claim form for 30 minutes, then send it and sign in again

The demo clock above the window stands in for the time away; it is not part of the insurer’s site. Does the form say how long you can leave it? After signing in again, what is left of your claim? Then apply a fix and do the same.

Broken Can you fix this?

BrokenA sign-in that drops what was sent
Demo clock: away from the form for 0 min
Harbourline Signed in as Alex

Make a claim

A recreated demo. The broken version is intentionally inaccessible.

03

The fix

Keep what people typed through signing in again

Before
BrokenA sign-in that drops what was sent
<form id="claim" method="post" action="/claims">  <h1>Make a claim</h1>  <label for="policy">Policy number</label>  <input id="policy" name="policy" value="{{ fields.policy }}">  <label for="what">What happened?</label>  <textarea id="what" name="what" rows="8">{{ fields.what }}</textarea>  <button>Send claim</button></form>
What is wrong4 points
  • Nothing on the form says that people are signed out after 30 minutes, or that what they typed is then lost.
  • Typing sends nothing, so 30 minutes of writing counts as 30 minutes away.
  • A claim sent after that is dropped: only the form's address is kept for after sign-in.
  • After signing in, the form comes back empty.
After

Sign in again on the page, then send the same claim

<form id="claim" method="post" action="/claims">  <h1>Make a claim</h1>  <label for="policy">Policy number</label>  <input id="policy" name="policy" value="{{ fields.policy }}">  <label for="what">What happened?</label>  <textarea id="what" name="what" rows="8">{{ fields.what }}</textarea>  <button>Send claim</button></form> <dialog id="sign-in-again" aria-labelledby="sign-in-title">  <form id="sign-in" method="post" action="/sign-in">    <h2 id="sign-in-title">Sign in again to send your claim</h2>    <p>Your claim is still here. Enter your password to send it.</p>    <input type="hidden" name="username" value="{{ user.email }}" autocomplete="username">    <label for="password">Password</label>    <input id="password" name="password" type="password" autocomplete="current-password">    <button>Sign in and send</button>  </form></dialog>
How it is fixed4 steps
  1. Send the claim from the page with fetch, so the form stays as it is whatever the server answers.
  2. When the session has ended, answer the claim with 401 instead of a redirect, so the page knows to ask.
  3. Open a sign-in dialog over the form with showModal(). Focus moves into it, the account is already filled in, so only the password is asked for, and a password manager can fill that in.
  4. Once signed in, close the dialog and send the same claim again.

This fixes the Before and passes 2.2.5 and 2.2.6: the claim never leaves the page, so no time away loses it. Only closing the tab does, and W3C doesn't count that as a timeout. It needs a script, and a sign-in the page can make itself; a site that signs people in through another site needs the next fix, or the notes on single sign-on below.

04

Verify the fix

5 checks, no mouse.

Test with: Keyboard, Screen reader, Password manager

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 form change.

How screen readers handle <dialog>

Limits

This covers losing what was typed when a session ends, and saying how long that takes. Warning people before a limit ends and letting them extend it is level A, with its own guide: session timeouts with no warning or way to extend. A task with any time limit at all is 2.2.3 No Timing, with its own guide: checkout timers that release held seats. 2.2.5 and 2.2.6 are AAA, and W3C doesn't recommend requiring AAA for whole sites, but for a long form behind a sign-in, both are met by keeping what was typed. Whether that is safe to keep, and for how long, is for the people who run the service to decide, with their privacy advisers.

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