Warn Users Before Session Timeout
Learn how to implement accessible session timeout warnings that give users time to respond.
What Is It?
Session timeout warnings alert users before their session expires, usually with a modal or notification. Users can then click to extend their session or save their work.
Affected users: Users with cognitive disabilities, users with motor disabilities, slow readers, screen reader users, users on slow connections
Why It Matters
Users with cognitive disabilities or motor disabilities may need extra time to save work. Blind users navigating with screen reader need time to notice and respond to timeout warning.
How to Detect This Issue
Use application and let it idle. Check if timeout warning appears with enough time to respond. Check warning is announced to screen readers. Verify 'Extend' button is keyboard accessible.
Code Examples & Fixes
HTML / CSS
Session ends silently, user loses unsaved work<div role="alertdialog" aria-labelledby="timeout-title" aria-describedby="timeout-message">
<h2 id="timeout-title">Session Expiring</h2>
<p id="timeout-message">Your session will end in 2 minutes due to inactivity. Click "Continue" to stay signed in.</p>
<button onclick="extendSession()">Continue</button>
<button onclick="logout()">Sign Out</button>
</div>Use role="alertdialog" for timeout warnings. Provide at least 2-5 minutes before timeout. Make buttons accessible and clearly labeled.
React / Next.js
Session manager silently logs out userconst [showTimeout, setShowTimeout] = useState(false); const [timeRemaining, setTimeRemaining] = useState(300); // 5 min
return (<>\n {showTimeout && (
<div role="alertdialog" aria-label="Session timeout warning">
<p>Your session expires in {Math.floor(timeRemaining / 60)} minute(s)</p>
<button onClick={() => extendSession()}>Stay Signed In</button>
<button onClick={() => logout()}>Sign Out</button>
</div>
)}
</>);Show warning dialog with countdown timer. Provide clear action buttons. Announce updates to screen readers.
WordPress
Dashboard session ends without warningUse plugin like "Session Timeout" that displays countdown before logout, allows extend with buttonInstall WordPress session timeout plugin with accessibility features. Ensure countdown is readable and buttons are keyboard accessible.
Shopify Liquid
Checkout session expires, user loses cart without warningImplement session timeout warning 5-10 minutes before expiration with "Continue Shopping" button and clear explanationFor checkout flows, provide extended timeout and visible, accessible warning. Announce timeout risk clearly.
Common Mistakes
Timeout warning disappears too quickly for users to read
Warning only shown visually, not announced to screen readers
Insufficient time before timeout (less than 2 minutes)
Session expires even while user is interacting (should extend on activity)
Warning modal can't be dismissed with keyboard or screen reader
Frequently Asked Questions
How much time should users get before timeout?
Should activity reset the timeout counter?
What role should timeout warning use?
Should the warning be dismissable?
Check your website for free
Get your ADA, WCAG, privacy & security score in 90 seconds.