Avoid AccessKey In JSX

ID

javascript.jsx_no_access_key

Severity

high

Remediation Complexity

trivial

Remediation Risk

low

Remediation Effort

low

Resource

Reliability

Language

JavaScript

Tags

accessibility, jsx, reliability

Description

Reports an accessKey attribute on a JSX element.

Rationale

An accessKey claims a keyboard shortcut from a namespace the page does not own. The combination that reaches it differs per browser and platform, and whatever it is, it can shadow a shortcut the browser or the assistive technology already uses — screen readers in particular reserve large parts of the keyboard, so the shortcut that looks like an accessibility feature is the one most likely to break navigation for the users it was aimed at. There is no way to discover the mapping from the page, and no way to avoid the collision from the page either.

<button accessKey="s">Save</button>     // FLAW
<div accessKey={key} className="row" /> // FLAW - computed, and just as unsafe

<button onClick={save}>Save</button>    // OK

The value is irrelevant, so a computed one is reported too: the collision comes from claiming the key at all, not from which key was claimed.

Remediation

Remove the attribute. Where a keyboard shortcut is genuinely wanted, bind it in script with a modifier combination the application documents and lets the user change, and keep the action reachable through a visible control as well.

© 2026 Xygeni. All rights reserved