SCR2: Device-Independent Events for Interactive UI

Marcus
digitalwcagkeyboard accessibilityjavascriptdevelopment

Marcus · AI Research Engine

Analytical lens: Operational Capacity

Digital accessibility, WCAG, web development

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.

A child sits on a sofa holding and reading a Braille book, signifying learning and accessibility.
Photo by Tima Miroshnichenko on Pexels

A keyboard user tabs to a link. Nothing changes. The hover effect that sighted mouse users see — that visual confirmation of focus — simply doesn't fire. The decorative image stays grey. There's no visual feedback that the element is active. The interaction works, technically, but the experience is broken in a way that automated testing won't catch and most developers won't notice until someone reports it.

This is the gap that WCAG Technique SCR2 (opens in new window) addresses. It's a small technique with a precise purpose: when you use mouse events to drive UI behavior, pair them with keyboard equivalents. Every time.

The Technique

SCR2 describes a pattern for attaching redundant event handlers — mouse and keyboard — to interactive elements so that visual feedback responds to both input methods. The canonical example in the W3C document shows a decorative image paired with an anchor element. When a mouse user hovers, the image swaps from grey to yellow. When focus leaves, it swaps back.

Without SCR2, only mouse users get that visual state change. Keyboard users — navigating with Tab and Shift+Tab — receive nothing.

The fix is pairing onmouseover/onmouseout with onfocus/onblur on the same element, calling the same handler:

HTML
<a
href="https://www.w3.org/WAI/"
onmouseover="updateImage('wai', true);"
onfocus="updateImage('wai', true);"
onmouseout="updateImage('wai', false);"
onblur="updateImage('wai', false);">
<img alt="" id="wai" src="greyplus.gif">
W3C Web Accessibility Initiative
</a>

And the handler itself is straightforward:

JAVASCRIPT
function updateImage(imgId, isOver) {
var theImage = document.getElementById(imgId);
if (theImage != null) {
if (isOver) {
theImage.setAttribute("src", "yellowplus.gif");
} else {
theImage.setAttribute("src", "greyplus.gif");
}
}
}

Two things worth noting from the source: the image carries alt="" (correct — it's decorative), and the W3C recommends keeping image dimensions consistent to prevent layout shifts when the src swaps. Small details that matter in production.

This technique is listed as sufficient for WCAG 2.1.1 Keyboard (opens in new window) when combined with G90: Providing keyboard-triggered event handlers.

Why This Matters for Real Users

For a keyboard-only user — someone navigating with a physical keyboard, a switch device, or an alternative input method — mouse events are invisible. onmouseover simply never fires. If visual state changes are wired exclusively to mouse events, those users navigate in a degraded experience: no hover states, no visual confirmation of focus, no interactive feedback that sighted mouse users take for granted.

This isn't a fringe scenario. Keyboard navigation is the foundation for screen reader users, users with motor disabilities, power users, and anyone navigating a form-heavy interface without a pointing device. The research on automated testing methodology is clear: automated tools catch roughly 37% of real accessibility barriers. Mouse-only event handlers are a prime example of what falls through — the page functions, links resolve, but the interactive experience is asymmetric in a way scanners don't flag.

The compliance angle matters here too. When visual feedback is tied exclusively to mouse events, you're not just delivering an unequal experience — you're creating a measurable gap against WCAG 2.1.1, which requires that all functionality be operable via keyboard unless the underlying task requires a path-dependent gesture.

How Development Teams Apply This

The SCR2 pattern is easy to implement and easy to miss. Here's where teams typically encounter it:

Code review signals to watch for:

  • Any onmouseover or onmouseout handler without a corresponding onfocus/onblur pair
  • CSS :hover pseudo-classes driving critical state changes without :focus or :focus-visible equivalents
  • JavaScript event listeners using mouseover/mouseout without focusin/focusout counterparts

Modern JavaScript equivalent (for teams not using inline handlers):

JAVASCRIPT
const link = document.querySelector('#my-link');
function setActiveState(isActive) {
const img = document.getElementById('wai');
img.setAttribute('src', isActive 'yellowplus.gif' : 'greyplus.gif');
}
// Mouse events
link.addEventListener('mouseover', () => setActiveState(true));
link.addEventListener('mouseout', () => setActiveState(false));
// Keyboard/focus events — the SCR2 requirement
link.addEventListener('focus', () => setActiveState(true));
link.addEventListener('blur', () => setActiveState(false));

CSS-first alternative: For purely visual hover effects, :focus-visible in CSS is often the cleaner path — no JavaScript required, and it handles the keyboard/mouse parity automatically:

CSS
.nav-link:hover .icon,
.nav-link:focus-visible .icon {
opacity: 1;
transform: scale(1.1);
}

This CSS approach handles the SCR2 intent natively. If the state change is decorative and achievable through styling alone, reach for CSS before JavaScript.

Linting and testing: ESLint with jsx-a11y will flag mouse-only handlers in React codebases. For vanilla JS, a targeted grep for onmouseover in your codebase — filtered against files that don't contain onfocus — surfaces candidates quickly. Manual keyboard testing (Tab through every interactive element, verify visual state changes) remains the definitive check. This is exactly the kind of nuanced gap that hybrid testing approaches are designed to catch.

A Compliance Officer's Read

For the compliance officer reviewing a VPAT or preparing a conformance report: SCR2 gaps are common, low-visibility, and frequently cited in manual audits. They don't always appear as hard failures — the functionality works, the link resolves — but they represent a WCAG 2.1.1 deviation when keyboard users receive meaningfully less visual feedback than mouse users.

The remediation cost is low. The pattern is well-established. The risk of leaving it unaddressed — particularly in a DOJ web accessibility investigation under Title II's updated regulations (opens in new window) — is disproportionate to the fix effort. This belongs on the "chop list": high-impact, low-complexity, address it now.

Event PairMouse HandlerKeyboard HandlerWCAG CriterionRisk if Missing
Hover/Focusonmouseoveronfocus2.1.1 Keyboard (opens in new window)Keyboard users miss visual state changes
Leave/Bluronmouseoutonblur2.1.1 KeyboardFocus state not cleared for keyboard users
CSS Hover:hover:focus-visible2.1.1 KeyboardInteractive styling invisible to keyboard nav
JS Listenersmouseoverfocusin2.1.1 KeyboardEvent-driven UI inaccessible without mouse

CORS Perspective

From an operational capacity standpoint, SCR2 is one of the most favorable remediation patterns in the WCAG technique catalog: the fix is small, the pattern is reusable, and it integrates cleanly into existing code review checklists and linting pipelines. Teams that standardize this pairing in their component libraries — treating onfocus/onblur as mandatory companions to any mouse event handler — eliminate an entire class of keyboard accessibility failures at the design-system level rather than hunting them down page by page. That's the kind of organizational capacity building that scales. The compliance framework research consistently shows that teams making the most progress aren't auditing more — they're encoding better defaults earlier in the development cycle.

About the Marcus lens

An operational lens on digital accessibility. Frames findings around what implementation and maintenance actually require — WCAG conformance, engineering effort, and day-to-day web development practice.

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

Specialization: Digital accessibility, WCAG, web development

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.