Foundry

Session timeout warning

A warning before the server signs somebody out for inactivity, with a way to stay signed in: WCAG 2.2.1 (Timing Adjustable) asks for both. Worth having before any app that holds health data adds an idle timeout. The rules: warn well ahead (two minutes in a real app), treat closing the warning as staying, never as signing out, say what will be lost, and announce the countdown sparingly rather than every second.

Try it

This demo uses a 40-second session: the warning appears 10 seconds after you start it, then counts down 30 seconds. Press Stay signed in, or Escape, to start again; let it run out to see what happens next. Open this page in a second tab and start it there too: staying signed in from one tab moves the other tab's clock as well.

Using it in an app

  • Include components/_session_timeout.html.twig once in the signed-in shell, with the server's real idle timeout and a 120-second warning.
  • Add a keep-alive route: POST, CSRF-checked, touching the session and answering 204.
  • Point expired_url at the sign-in page, with a note saying why they were signed out.
  • Copy session_timeout_controller.js; there are no inline handlers.

Customise

Changes apply as you choose them.

Theme
Colour

Preview the kit in another accent. Fifteen colours, evenly spaced and equally strong, each measured to pass AA in light and dark; high contrast keeps its own.

Skin
Layout

On screens narrower than a laptop every layout uses the slide-out menu.

Content width
Density
Font
Space Grotesk headings, IBM Plex Sans text
Inter throughout
Your device's own font

Saved in two cookies on this device (fo_theme, fo_shell), never sent anywhere else. Privacy notice.

Help

About this page

Session timeout warning

Press Start a 40-second session. Ten seconds later a dialog says you are about to be signed out and counts down. Stay signed in, or Escape, starts the clock again; Sign out now ends it. In an app the warning comes two minutes before the idle sign-out.


Without a mouse

Every control on this site works from the keyboard, including this panel (Escape closes it). Anything you can drag also has a menu or form that does the same thing.


Still stuck?