Refreshes and redirects need to wait for the user
- Rule:
axe/meta-refresh - Checks: Delayed refresh under 20 hours must not be used
- WCAG: 2.2.1
- Fix class:
mechanical: A fix needs no authored text or visual decision.
Who it affects
Section titled “Who it affects”- People who use a screen reader or a braille display, most of them blind.
- People with cognitive, learning or attention disabilities.
- People who use a keyboard or a switch device instead of a mouse.
How to fix it
Section titled “How to fix it”The meta tag redirects to another page after a delay
Section titled “The meta tag redirects to another page after a delay”Redirect on the server with an HTTP redirect status, such as 301, so no interim page is shown. If only HTML is available, redirect at once with a delay of 0, and link to the new address in the page body.
<meta http-equiv="refresh" content="0; url=/pricing">The meta tag reloads the page to show fresh content
Section titled “The meta tag reloads the page to show fresh content”Remove it. Update the content in place with script, and give people a control to pause the updates, or a button to refresh when they choose.
The meta tag ends a session after a set time
Section titled “The meta tag ends a session after a set time”Replace it with script that warns people before the session ends and lets them extend it with a simple action, such as a button. Give them at least 20 seconds to respond, and allow at least ten extensions.
Fixes that fail
Section titled “Fixes that fail”Replacing the meta tag with a script timer that reloads the page
Section titled “Replacing the meta tag with a script timer that reloads the page”axe no longer sees it, but a reload people cannot turn off, adjust or extend still takes their place and unsaved input, which fails WCAG 2.2.1.
Raising the delay past 20 hours to pass the rule
Section titled “Raising the delay past 20 hours to pass the rule”This rule exempts such long delays, but the refresh still interrupts anyone who leaves the page open, and axe reports it under meta-refresh-no-exceptions.
More on the rule
Section titled “More on the rule”axe-core’s documentation of the rule
CORA’s fix guidance adapts content from accessibility-agents, under the MIT License: see its notice.