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

ValueBehavior
Single characterA case-insensitive letter or digit that serves as the shortcut key
Space-separated charactersMultiple fallback keys. The browser picks the first one it can use without conflict.
<!-- Keyboard shortcut to focus the search field --> <label for="search">Search</label> <input type="text" id="search" accesskey="s" placeholder="Press Alt+S to focus" /> <!-- Shortcut to activate a button --> <button accesskey="n">New Item</button> <!-- Shortcut on a link --> <a href="/dashboard" accesskey="d">Dashboard</a>

Platform Modifiers

The modifier key combination varies by platform and browser. For an accesskey="s":

PlatformModifierFull Shortcut
Windows (Chrome, Edge)AltAlt+S
Windows (Firefox)Alt+ShiftAlt+Shift+S
macOS (Chrome, Edge)Ctrl+AltCtrl+Alt+S
macOS (Firefox)Ctrl+AltCtrl+Alt+S
macOS (Safari)Ctrl+AltCtrl+Alt+S
Linux (Chrome)AltAlt+S
Linux (Firefox)Alt+ShiftAlt+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.

<nav aria-label="Admin shortcuts"> <a href="/admin/orders" accesskey="o">Orders</a> <a href="/admin/products" accesskey="p">Products</a> <a href="/admin/users" accesskey="u">Users</a> <a href="/admin/settings" accesskey="t">Settings</a> </nav> <main> <label for="admin-search">Search</label> <input type="search" id="admin-search" accesskey="s" /> <button accesskey="n">New Order</button> </main>

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.

<footer> <p>Keyboard shortcuts: press <kbd>Alt+S</kbd> to search, <kbd>Alt+N</kbd> for new item, <kbd>Alt+D</kbd> for dashboard. </p> </footer>

Multiple Fallback Keys

You can provide space-separated characters. The browser uses the first one that does not conflict with an existing shortcut.

<!-- Multiple keys: browser picks the first available one --> <button accesskey="s n">Save</button>

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 detection
  • tabindex — control focus order for keyboard navigation
  • Accessibility Guide — overview of VB's accessibility patterns