SCR18: Client-Side Validation That Actually Tells Users What Went Wrong

David
digitalwcagformsclient side scriptingerror handlingscreen readerskeyboard accessibility

David · AI Research Engine

Analytical lens: Balanced

Higher education, transit, historic buildings

AI-assisted · Source-linked · Editorially reviewed · Methodology

Trust note

This article was drafted with AI assistance, reviewed against accessibility.chat editorial standards, and should be treated as research and education rather than legal advice. We prioritize primary sources and correct material errors.

Two athletes in wheelchairs compete in an intense indoor fencing match, highlighting strength and determination.
Photo by Ron Lach on Pexels

A form field rejects your input. No explanation. No focus. Just silence — or worse, a generic browser error that tells you nothing. WCAG Technique SCR18 (opens in new window) exists precisely to prevent that moment. It's one entry in W3C's official techniques catalog, but it addresses something that breaks real people's ability to complete real tasks every day.

The technique is straightforward: validate user input as values are entered, use a client-side alert to describe any error in plain text, and then — critically — return keyboard focus to the field where the error occurred. Three steps. Widely understood. Still routinely skipped or implemented incorrectly.

The Technique

SCR18 (opens in new window) is classified as a sufficient technique for Success Criterion 3.3.1 Error Identification (opens in new window), which requires that when an input error is detected, the item in error is identified and the error is described to the user in text. It also serves as an advisory technique for 3.3.3 Error Suggestion (opens in new window) and 3.3.4 Error Prevention (opens in new window).

The W3C document provides two code patterns. The first validates a single field on change:

HTML
<label for="date">Date:</label>
<input type="text" name="date" id="date"
onchange=if(isNaN(Date.parse(this.value)))
alert('This control is not a valid date. Please re-enter the value.');>

The second checks multiple fields on form submission, using an onsubmit handler that returns false to cancel the submit attempt when errors are found — keeping the user in place so they can correct the problem.

The W3C document is candid about the alert approach: it works, but it's a floor, not a ceiling. The spec notes that "a more helpful notification to the user would be to highlight the controls with problems and add information to the page about the nature of the errors." SCR18 gives you a sufficient implementation. What you do beyond that determines whether your form is merely compliant or genuinely usable.

Why This Matters

Error identification failures hit different user groups in different ways — and the compounding effects are severe.

Screen reader users depend entirely on programmatic text to understand what went wrong. A visual red border means nothing to someone who can't see it. An alert() dialog, for all its limitations, is announced immediately by most screen readers. That's not nothing.

Keyboard-only users face a navigation problem on top of an information problem. If focus doesn't return to the field with the error, they have to tab through the entire form to find it. On a long form, that's not an inconvenience — it's a barrier that causes people to abandon the task entirely.

Users with cognitive disabilities need error messages that are specific and actionable. "Invalid input" is useless. "Please enter a date in MM/DD/YYYY format" is helpful. SCR18 creates the mechanism; the message content is what makes it work for people who need explicit guidance.

Low-vision users who zoom significantly may not see an error message that appears outside their current viewport. Focus management — moving the user to the error location — is the functional fix.

This isn't abstract. Forms are how people apply for benefits, register for services, submit healthcare information, and access government programs. When error handling fails, the form fails. And as our research on automated testing limitations shows, many of these failures go undetected because automated tools catch structural issues but miss the experiential breakdown of a poorly worded error message or missing focus management.

How It Works

The core pattern for multi-field validation looks like this:

HTML
<form onsubmit="return validateForm()">
<label for="email">Email:</label>
<input type="text" id="email" name="email">
<label for="phone">Phone:</label>
<input type="text" id="phone" name="phone">
<input type="submit" value="Submit">
</form>
<script>
function validateForm() {
var email = document.getElementById('email');
var phone = document.getElementById('phone');
if (email.value === '') {
alert('Email address is required. Please enter your email.');
email.focus(); // Returns keyboard focus to the error field
return false; // Cancels form submission
}
if (phone.value === '') {
alert('Phone number is required. Please enter your phone number.');
phone.focus();
return false;
}
return true; // Validation passed
}
</script>

The return false pattern is the mechanism that prevents submission and keeps the user in context. The .focus() call after the alert dismissal is what makes this accessible beyond the bare minimum — it answers the question "okay, I acknowledged the error, now where do I go?"

WCAG CriterionLevelSCR18 RoleWhat It Requires
3.3.1 Error Identification (opens in new window)AASufficientError identified and described in text
3.3.3 Error Suggestion (opens in new window)AAAdvisorySuggestions for correction provided
3.3.4 Error Prevention (opens in new window)AAAdvisoryReversible, checked, or confirmable submissions

Applying This

Three things to check in code review:

1. Does the error message describe the problem specifically? Generic messages like "Error" or "Invalid" fail 3.3.1 in practice even if they technically satisfy it in form. Look for messages that name the field and describe the expected format.

2. Is focus managed after the alert dismisses? Search for alert( calls in form validation code. If .focus() doesn't follow on the relevant field, that's a gap. This is especially critical for multi-field forms.

3. Is validation happening at the right moment? On-change validation (checking as the user leaves a field) is more helpful than submit-only validation — users get feedback before they've moved on. But aggressive on-keypress validation can be disruptive. The right trigger depends on the field type.

Automated testing tools will catch missing <label> elements and some ARIA errors, but they won't evaluate whether your error message is descriptive enough, or whether focus management actually works in context. This is exactly the gap that hybrid testing approaches are designed to close — manual review of error flows should be a standard part of any form audit.

For teams moving beyond the alert() pattern: inline error messages associated with their fields via aria-describedby, combined with an error summary at the top of the form, give users more control and a better experience. That's the direction the ARIA Authoring Practices Guide (opens in new window) points toward. SCR18 is the starting point, not the destination.

CORS Perspective

Form validation errors sit at the intersection of all four CORS dimensions simultaneously. Operationally, this is a low-cost fix — the code patterns are simple, the testing is manual but fast, and the impact is immediate. The risk exposure is real: 3.3.1 (opens in new window) is a Level AA requirement under WCAG 2.2 (opens in new window), meaning it's enforceable under Title II and Title III of the ADA, and organizations that can't demonstrate accessible error handling in high-stakes forms — benefits applications, healthcare portals, financial transactions — face meaningful legal exposure. Strategically, form accessibility is one of the clearest cases where equal access and organizational efficiency align: when error handling works, fewer users abandon forms, fewer support calls get made, and fewer complaints get filed. And from a community perspective, the people most affected by broken error handling are often those with the fewest alternatives — users who rely on assistive technology to access services they can't access any other way. That's the real reason SCR18 exists in the catalog.

About the David lens

A balanced lens that weighs competing considerations before recommending. Applied to higher education, transit, and historic-building access questions.

David is an AI analyst lens, not a human staff member. It helps frame this article through a consistent accessibility perspective.

Specialization: Higher education, transit, historic buildings

View all articles using this lens →

Transparency Disclosure

This article was drafted with AI assistance and reviewed against our editorial methodology. We disclose that process so readers can judge the work clearly.