{"record":{"id":"7a8b7ca871725fb1","repo":"oxc-project/oxc","slug":"no-access-key-attribute-allowed","errorCode":null,"errorMessage":"No access key attribute allowed.","messagePattern":"No access key attribute allowed\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"crates/oxc_linter/src/rules/jsx_a11y/no_access_key.rs","lineNumber":12,"sourceCode":"use oxc_ast::{\n    AstKind,\n    ast::{JSXAttributeItem, JSXAttributeValue},\n};\nuse oxc_diagnostics::OxcDiagnostic;\nuse oxc_macros::declare_oxc_lint;\nuse oxc_span::Span;\n\nuse crate::{AstNode, context::LintContext, rule::Rule, utils::has_jsx_prop_ignore_case};\n\nfn no_access_key_diagnostic(span: Span) -> OxcDiagnostic {\n    OxcDiagnostic::warn(\"No access key attribute allowed.\")\n        .with_help(\"Remove the `accessKey` attribute. Inconsistencies between keyboard shortcuts and keyboard commands used by screen readers and keyboard-only users create accessibility complications.\")\n        .with_label(span)\n}\n\n#[derive(Debug, Default, Clone)]\npub struct NoAccessKey;\n\ndeclare_oxc_lint!(\n    /// ### What it does\n    ///\n    /// Enforces that the `accessKey` prop is not used on any element to avoid complications with keyboard commands used by a screen reader.\n    ///\n    /// ### Why is this bad?\n    ///\n    /// Access keys are HTML attributes that allow web developers to assign keyboard shortcuts to elements.\n    /// Inconsistencies between keyboard shortcuts and keyboard commands used by screen readers and keyboard-only users create accessibility complications so to avoid complications, access keys should not be used.\n    ///\n    /// ### Examples","sourceCodeStart":1,"sourceCodeEnd":30,"githubUrl":"https://github.com/oxc-project/oxc/blob/e1e7af627c8843ab64044ed466b128fcc21a035b/crates/oxc_linter/src/rules/jsx_a11y/no_access_key.rs#L1-L30","documentation":"This is the `jsx_a11y/no-access-key` rule in oxlint. It fires when any JSX element carries an `accessKey` prop (matched case-insensitively via `has_jsx_prop_ignore_case`). Browser access-key shortcuts frequently collide with shortcuts used by screen readers and keyboard-only users, so jsx-a11y bans the attribute entirely.","triggerScenarios":"Any JSX opening element with an `accessKey` / `accesskey` attribute, regardless of element type or value. The diagnostic is raised from the constructor at crates/oxc_linter/src/rules/jsx_a11y/no_access_key.rs:11 when the prop is found.","commonSituations":"Legacy enterprise apps that added keyboard shortcuts via `accessKey`; copy-pasted HTML converted to JSX; enabling the jsx-a11y strict preset on an older codebase; developers unaware that screen readers reserve alt+letter combinations.","solutions":["Remove the `accessKey` attribute entirely.","If a keyboard shortcut is genuinely needed, implement it with a `keydown` listener on a focused container or a well-tested library, avoiding single alt+letter combos.","Disable the rule inline only if the shortcut has been verified against screen-reader shortcuts."],"exampleFix":"// before\n<button accessKey=\"s\" onClick={save}>Save</button>\n\n// after\n<button onClick={save}>Save</button>","handlingStrategy":"validation","validationCode":"npx oxlint --jsx-a11y/no-access-key src/ # or: rg -n 'accessKey' --iglob '*.{tsx,jsx}' src/","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never add accessKey attributes; treat the attribute as banned by convention.","Implement shortcuts via a global keydown handler with documented, non-conflicting combos.","Code-review grep for 'accessKey' before merging feature branches."],"tags":["jsx-a11y","react","accessibility","keyboard-shortcuts","lint"],"backgroundTag":"accesskey-accessibility","analyzedSha":"e1e7af627c8843ab64044ed466b128fcc21a035b","analyzedAt":"2026-08-20T07:01:07.079Z","contentChangedAt":"2026-08-20T07:01:07.079Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}