Skip to main content

BETANow in public beta.Public betaBeta

日本語Español

MDL-006 Published · Updated

Session timeout warning modal

A modal that warns people before they are signed out or their answers are cleared for inactivity, and lets them extend the time.

Wireframe (desktop) | Session timeout warning modal

Session timeout warning modal UI design (desktop wireframe)

Wireframe (mobile) | Session timeout warning modal

Session timeout warning modal UI design (mobile wireframe)

What changes on mobile

  1. The modal sits in the center with space on each side: So it is clear the form in progress is still behind it, it does not fill the screen.
  2. Buttons stack, with "Stay signed in" on top: Side by side, the labels wrap easily; putting continue on top avoids mis-taps when people are in a hurry.
  3. The countdown stays large: The description is kept short so the number does not have to shrink.
  4. The timed-out details stack: People read the task they were doing and what to do next from top to bottom.

Before you choose this pattern | Session timeout warning modal

Good fit

  • People are signed out, or their answers cleared, after a period of inactivity
  • Forms take a while to fill in, or screens are used while signed in
  • The time limit cannot be removed, for security or similar reasons
  • Member accounts, online applications, bookings and checkouts, insurance and banking

Poor fit

  • You need confirmation before an action that cannot be undone (the confirmation dialog works better)
  • There is no time limit, or the limit can be removed (this warning is not needed; even with only a few fields, plan for it whenever a timeout exists)
  • You want long input split into stages so it is not lost (a multi-step form that saves each stage works better; saving each stage and a timeout warning can be used together)

Why this wireframe works | Session timeout warning modal

Warn before time runs out, and say what will happen

Some sites sign people out, or clear their answers, after a period of inactivity for security. Timing out without notice hurts most the people who have typed the most. Warning a little before the limit, such as “we will sign you out in 2 minutes”, and saying what will happen to their answers lets people choose to continue before anything is lost.

One button extends the time

A warning does not help if extending is hard to figure out. Pressing “Stay signed in” should extend the session and return people to their form, and that button should have focus when the warning opens. People get back to their task in one action, without thinking or searching.

It opens on a timer, not when someone presses something

Other modals normally open when the user presses a button. This one opens on its own after a set period of inactivity. Because it appears unexpectedly, the title states the situation briefly, such as “You are about to be signed out”, so it is clear at a glance why it opened.

Show the time left, but announce it only at intervals

The screen shows the time remaining as a number, counting down. Announcing it every second to a screen reader, however, makes everything else impossible to do. Reading the title and description when it opens, then announcing only at meaningful points such as one minute left, keeps people informed without getting in their way.

After a timeout, say what happened and what to do next

Dropping people back on a sign-in screen after a timeout leaves them unsure what happened. Say why, such as “For your security, we signed you out”, and state clearly whether their answers were saved. A “Sign in again” button lets them move on to the next step without hesitation.

Common mistakes | Session timeout warning modal

Signing people out with no warning

If people are signed out mid-form without notice, they only find out when they submit, and have to start again. Warn before the time runs out and let people extend it.

Announcing the time left every second

If the countdown is announced and updated every second, the screen reader keeps reading numbers and it becomes hard to reach the buttons. Keep the countdown itself out of announcements and limit how often you announce.

“Stay signed in” does not extend the server session

If only the on-screen timer restarts and the server session is not extended, people think they have continued but are signed out when they submit. When the button is pressed, tell the server to extend the session too.

Not saying what happened to their answers

“You have been signed out” alone leaves people unsure whether their answers are still there and whether to start again. Say whether answers were saved, and if not, that they need to start again.

Clicking the backdrop or pressing Esc signs people out

Someone who notices the warning and tries to dismiss it should not lose their answers. Do not close on a backdrop click, and treat Esc the same as “Stay signed in”. Sign out only when that button is chosen.

Treating Esc as a session extension

Extend the session only when the person chooses “Keep using”, after checking their authentication state. Even if Esc closes the dialog, closing alone must not extend the authentication period. After expiry, log out safely.

FAQ | Session timeout warning modal

How long before the timeout should the warning appear?

WCAG 2.2 Success Criterion 2.2.1 (Timing Adjustable) says that when you meet it by letting people extend the limit, you must warn them before time expires and give them at least 20 seconds to extend it with a simple action. Some government services time out after 15 minutes of inactivity and warn 2 minutes before. Allowing well over 20 seconds, for both reading and responding, is common.

Are modals not supposed to open only when someone presses something?

Yes, other modals normally open on a user action. A timeout warning is the exception: it opens on its own because otherwise people would lose their answers. For the same reason, use it only on screens that really have a time limit, and never reuse this behavior for notices or promotions.

Can we limit how many times people extend the time?

WCAG 2.2 Success Criterion 2.2.1 says that when you rely on extending, people must be able to extend at least ten times. If you set a limit for security, make it at least ten. Other options apply when people can turn the limit off or adjust it to at least ten times the default beforehand, or when the limit is longer than 20 hours.

Does this pattern work for forms without sign-in?

Yes. If you clear answers after a period of inactivity, warn in the same way even without sign-in. In that case say “We will delete your answers in 2 minutes” and let people choose between continuing and deleting their answers.

Related pages

Share this pattern

Send this page to your team or your design partner.

Was this pattern useful?

Written by

Yuta Okano

ENVY DESIGN Inc.

CEO / Director / Designer

14 years in the web industry. Has worked on more than 500 web projects, from corporate and recruiting sites to e-commerce. Focuses on information architecture, direction and design, from planning websites to improving them. In recent years he has focused on AIO (AI optimization) and GEO, helping sites get cited by generative AI search such as ChatGPT, Perplexity and Google AI Overviews.

Review and revision history

  1. Published AvatarYuta Okano Pattern published