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:
@@ -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.',
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user