accesskey
Assigns a keyboard shortcut to activate or focus an element. Useful for power-user interfaces, but comes with significant discoverability and conflict challenges.
Overview
The accesskey attribute assigns a keyboard shortcut to an element. When the user presses the platform-specific modifier key combination plus the assigned key, the browser either activates the element (buttons, links) or focuses it (inputs, textareas).
Applies to: Any HTML element, though it is most useful on interactive elements like <button>, <a>, <input>, and <select>
Values
| Value | Behavior |
|---|---|
| Single character | A case-insensitive letter or digit that serves as the shortcut key |
| Space-separated characters | Multiple fallback keys. The browser picks the first one it can use without conflict. |
Platform Modifiers
The modifier key combination varies by platform and browser. For an accesskey="s":
| Platform | Modifier | Full Shortcut |
|---|---|---|
| Windows (Chrome, Edge) | Alt | Alt+S |
| Windows (Firefox) | Alt+Shift | Alt+Shift+S |
| macOS (Chrome, Edge) | Ctrl+Alt | Ctrl+Alt+S |
| macOS (Firefox) | Ctrl+Alt | Ctrl+Alt+S |
| macOS (Safari) | Ctrl+Alt | Ctrl+Alt+S |
| Linux (Chrome) | Alt | Alt+S |
| Linux (Firefox) | Alt+Shift | Alt+Shift+S |
This inconsistency is one of the biggest challenges with accesskey. Users must know their platform's modifier, and documentation must account for all variants.
Practical Example
Admin Dashboard
Internal tools and admin dashboards are the strongest use case. Users interact with the same interface daily and benefit from keyboard shortcuts to common actions.
Documenting Shortcuts
Because there is no standard browser UI to show available access keys, you must document them yourself. A footer, help dialog, or tooltip can list the available shortcuts.
Multiple Fallback Keys
You can provide space-separated characters. The browser uses the first one that does not conflict with an existing shortcut.
Conflict Risks
Access keys share keyboard shortcut space with the browser and the operating system. Common conflicts include:
- Alt+D — focuses the address bar in most browsers on Windows
- Alt+F — opens the File menu in many applications
- Alt+E — opens the Edit menu
- Ctrl+Alt+ combinations — used for special characters on some keyboard layouts (European layouts in particular)
When a conflict occurs, browser behavior varies: some prioritize the access key, others prioritize the browser shortcut, and some require pressing the key twice. Test thoroughly on target platforms.
Best Suited For
- Internal admin tools: Power users who learn the shortcuts and use them daily
- Power-user applications: Data entry, content management, or workflow tools
- Kiosk or single-purpose UIs: Controlled environments where browser shortcut conflicts are manageable
For public-facing websites, the discoverability gap and conflict risks typically outweigh the benefits. Consider visible keyboard hints or a dedicated shortcut system instead.
Accessibility
- Discoverability is the core problem. There is no standard, universal way to surface available access keys. Screen readers can announce them, but sighted keyboard users have no built-in way to discover them.
- Screen reader interaction: Most screen readers announce the access key when the element receives focus (e.g., "Search, edit, Alt+S"). However, screen readers often use their own keyboard shortcuts that may conflict.
- Do not rely on access keys as the only way to reach content. They are a convenience shortcut, not a replacement for logical tab order and visible navigation.
- Avoid overriding screen reader shortcuts. JAWS and NVDA use Alt and Ctrl combinations extensively. Test with actual screen readers.
Limitations
- No standard modifier: The activation key combination varies across platforms and browsers. You cannot control which modifier is used.
- No discoverability UI: Unlike macOS menu shortcuts or Windows underlined letters, browsers provide no visual indication that access keys exist.
- Conflicts are unavoidable: Some keys will conflict with browser, OS, or assistive technology shortcuts on some platforms.
- Single characters only: You cannot assign multi-key sequences (like G then D) using
accesskey. - Locale issues: The assigned character must be on the user's physical keyboard. Letters from one locale may not exist on keyboards in another.
See Also
data-hotkey— VB keyboard shortcut system with conflict detectiontabindex— control focus order for keyboard navigation- Accessibility Guide — overview of VB's accessibility patterns