Avoid Meta Refresh for Accessibility
Rule ID: meta-refresh-no-exceptions
Ruleset: axe-core 4.10
User Impact: Minor
Guidelines: WCAG 2.1 (AAA), WCAG 2.0 (AAA)
How to Fix the Problem
To meet accessibility guidelines and enhance user experience, remove any <meta>
elements that include the http-equiv="refresh"
attribute from your HTML documents.
Example of What to Remove:
Recommended Approach:
If the intent is to refresh or redirect a page, this should be handled using JavaScript instead of the <meta>
tag. Additionally, implement mechanisms that allow users to:
-
Pause the refresh
-
Extend the time before refresh
-
Disable the refresh entirely
For example:
You can enhance accessibility by offering UI controls to adjust or disable this behavior, such as:
Why it Matters
Automatically refreshing pages can disrupt the user experience—especially for people with disabilities:
-
Disorientation: Users do not expect a page to refresh, which can cause confusion and loss of context.
-
Loss of Focus: Page refresh resets the focus to the top of the page, potentially disorienting keyboard and screen reader users.
-
No User Control: Users cannot control the timing or occurrence of the refresh, violating principles of user autonomy.
-
Barriers for Screen Readers: Refreshing content unexpectedly can interfere with screen reader output and comprehension.
-
Cognitive Load: Users who process content more slowly may not finish reading before a refresh occurs.
For redirection purposes, server-side techniques are preferable, as they provide a cleaner and more predictable experience for all users.
Rule Description
The <meta http-equiv="refresh">
element should not be used because it forces an automatic refresh or redirect, denying users control over the timing of such actions. This can negatively affect users with visual, cognitive, and motor impairments.
The Algorithm (in Simple Terms)
-
Search the HTML document for any
<meta>
elements. -
Check if any contain the attribute
http-equiv="refresh"
. -
Flag those as violations of this accessibility rule.