Visual Focus Removed Using JavaScript
WCAG Focus: WCAG 2.4.7 (AA), 2.1.1 (A)
Some WordPress theme scripts call this.blur() inside onclick or onfocus handlers to clear the browser focus outline immediately after an element is clicked or focused. Doing so not only hides the visual focus ring but also destroys the user’s keyboard position in the document.
Why This Pattern Violates WCAG
WCAG 2.4.7 Focus Visible (Level AA) is violated whenever scripts actively strip focus visibility from interactive controls.
WCAG 2.1.1 Keyboard (Level A) is threatened when calling .blur() on focus resets the Tab order back to the document body, forcing keyboard users to restart navigation from the top of the page.
Code Comparison
Inaccessible JavaScript Blur Pattern
<a href="#section-2" onfocus="this.blur()">Jump to Section 2</a>
Compliant Link Using :focus-visible CSS Instead
<a href="#section-2" class="section-link">Jump to Section 2</a>
<style>
.section-link:focus-visible { outline: 2px solid #111; }
</style>
How to Fix It in WordPress
- Remove inline onfocus="this.blur()" attributes and JS event listeners that call element.blur() on interactive controls.
- Rely on native CSS :focus-visible if your goal is avoiding focus rings on mouse click while preserving them for keyboard navigation.
Finding This Issue Automatically
Legacy theme snippets and custom navigation scripts often hide blur() calls inside inline attributes or header scripts. The WP ADA Compliance Check plugin scans rendered markup and theme templates for JavaScript focus suppression, flagging affected controls so you can clean them up without manually grepping every plugin folder.
Subscribe
Subscribe to receive daily Web Accessibility - Did you know? articles in your inbox.

