# Keyboard Navigation and Command Palette

Mechanica now includes a global command palette for fast catalogue navigation without requiring pointer input.

## Shortcuts

| Shortcut | Behaviour |
| --- | --- |
| <kbd>Ctrl</kbd> + <kbd>K</kbd> | Open the command palette on Windows/Linux |
| <kbd>⌘</kbd> + <kbd>K</kbd> | Open the command palette on macOS/iPadOS keyboards |
| <kbd>/</kbd> | Open quick search when focus is not inside an editable field |
| <kbd>↑</kbd> / <kbd>↓</kbd> | Move through results |
| <kbd>Enter</kbd> | Open the active result |
| <kbd>Esc</kbd> | Close the palette |
| <kbd>Tab</kbd> / <kbd>Shift</kbd> + <kbd>Tab</kbd> | Stay trapped within the modal while it is open |

## Accessibility behaviour

- The palette is exposed as an `aria-modal` dialog with a labelled search combobox.
- Search result changes are announced through a polite live region.
- Active results are connected to the search input through `aria-activedescendant`.
- Focus is moved to the search input when opened and restored to the previous element when closed.
- A skip link is mounted at the shell level so keyboard and screen-reader users can bypass repeated navigation.

## Search model

The palette is registry-driven and indexes each machine by:

- name/title/label
- slug and id
- category and difficulty
- summary/description/overview fields
- tags, aliases, keywords, features, use cases, disciplines, and industries

The scoring utility intentionally supports multi-field queries such as `advanced pump` or `rotor engine`, making it useful for engineering vocabulary rather than only exact title matches.

## Test coverage

Pure search behaviour is covered by `tests/commandPalette.test.ts`, including normalisation, route generation, empty-query ordering, multi-token matching, multi-field searches, and ranking direct label matches above keyword-only matches.
