Add keyboard navigation to search results

Keep the search field focused while selecting results with Control or arrow keys, and open the selected result with Enter. Document the field-scoped shortcuts and cover navigation, reset, submission, and typing behavior with regression tests.
This commit is contained in:
2026-11-13 15:51:00 +00:00
parent eeb07e5645
commit ccc80a9a8d
9 changed files with 372 additions and 44 deletions
@@ -15,7 +15,8 @@ enum KeyboardShortcutGroup {
chat('Chat'),
windows('Windows'),
terminal('Terminal'),
lists('Lists');
lists('Lists'),
search('Search');
const KeyboardShortcutGroup(this.title);
@@ -64,6 +65,7 @@ class KeyboardShortcutRegistry {
..._windows,
..._terminal,
..._lists,
..._search,
];
String get _cheatsheetKeys => shellCheatsheetShortcutLabel(platform);
@@ -265,4 +267,14 @@ class KeyboardShortcutRegistry {
'In an artifact or file-diff viewer. Esc closes an artifact viewer.',
),
];
List<KeyboardShortcutEntry> get _search => [
const KeyboardShortcutEntry(
group: KeyboardShortcutGroup.search,
action: 'Move through Search results',
keys: 'Ctrl+N, Ctrl+P, Up, Down',
caveat:
'While the Search field is focused. Uses Control rather than Cmd on macOS; Enter opens the highlighted result.',
),
];
}