All rules

Sheath rule

a11y-no-accesskey

The accesskey attribute should not be used.
Package
Core
Default severity
warning by default
Auto-fix
Auto-fix available

with --dangerous (the fix removes the attribute)

The fix is withheld when the accesskey value is dynamic (for example a Blade echo), since removing the attribute would delete the expression with it.

#Why

accesskey shortcuts can conflict with browser, operating system, and assistive technology shortcuts. They are also difficult for users to discover.

#Examples

#Bad

<!-- Using accesskey attribute -->
<button accesskey="s">Save</button>
<a href="/home" accesskey="h">Home</a>
<input type="text" accesskey="e" placeholder="Email">

#Good

<!-- Use visible navigation instead -->
<button>Save</button>
<a href="/home">Home</a>
<input type="text" placeholder="Email">
<!-- Or provide keyboard hints in visible text -->
<button>Save (Ctrl+S)</button>
<!-- Use proper focus management -->
<button autofocus>Primary Action</button>

#Notes

  • If keyboard shortcuts are needed, implement them with JavaScript and document them visibly
  • Skip links give keyboard users a jump target without competing for a key combination
  • Focus management and logical tab order are more reliable accessibility patterns
  • WCAG Success Criterion 2.1.4 recommends against accesskey conflicts

#References

#Related Rules