Open Search with Alt slash shortcut

Accept the physical slash key for exact Alt+/ delivery, including macOS Option dead-key values, while preserving existing Ctrl+/ and Command+/ behavior. Add focused regression coverage and document the verified checks.
This commit is contained in:
2026-11-11 19:33:17 +00:00
parent 3da71c3053
commit aa8329460d
3 changed files with 53 additions and 4 deletions
+7 -4
View File
@@ -61,10 +61,13 @@ bool shellSearchShortcut(
TargetPlatform? platform,
}) =>
event is KeyDownEvent &&
event.logicalKey == LogicalKeyboardKey.slash &&
shellPrimaryModifier(keyboard, platform: platform) &&
!keyboard.isAltPressed &&
!keyboard.isShiftPressed;
!keyboard.isShiftPressed &&
(shellPrimaryModifier(keyboard, platform: platform)
? !keyboard.isAltPressed && event.logicalKey == LogicalKeyboardKey.slash
: keyboard.isAltPressed &&
!keyboard.isControlPressed &&
!keyboard.isMetaPressed &&
event.physicalKey == PhysicalKeyboardKey.slash);
const _digits = [
LogicalKeyboardKey.digit1,
+14
View File
@@ -0,0 +1,14 @@
# Open Search with Alt+/ and Command+/
- Updated `shellSearchShortcut` to accept an exact Alt+/ chord by physical
slash position, including macOS Option dead-key logical values.
- Existing Ctrl+/ and macOS Command+/ matching remains logical-slash based;
Shift and mixed/extra modifiers remain rejected.
- Search destination routing, focus, query retention, and composer drafts were
left unchanged.
- Focused checks: `tool/memwatch/full.sh 'test/shell/search_shortcuts_test.dart
test/shell/destination_shortcuts_test.dart test/shell/list_shortcuts_test.dart'`
— PASS (10 passed, 0 failed, 0 skipped).
- `tool/analyze.sh` — clean.
- Browser capture was not run in this implementation stage; UI review owns
full-app Alt+/ and Meta+/ interaction evidence.
+32
View File
@@ -75,6 +75,27 @@ void main() {
});
}
test('Alt+/ uses the physical slash key for Option dead-key delivery', () {
const event = KeyDownEvent(
physicalKey: PhysicalKeyboardKey.slash,
logicalKey: LogicalKeyboardKey(0x00BF),
character: '¿',
timeStamp: Duration.zero,
);
expect(shellSearchShortcut(event, _AltHeld()), isTrue);
expect(
shellSearchShortcut(
const KeyUpEvent(
physicalKey: PhysicalKeyboardKey.slash,
logicalKey: LogicalKeyboardKey(0x00BF),
timeStamp: Duration.zero,
),
_AltHeld(),
),
isFalse,
);
});
for (final platform in [TargetPlatform.macOS, TargetPlatform.windows]) {
testWidgets(
'Search chord opens and refocuses retained query on $platform',
@@ -130,3 +151,14 @@ void main() {
);
}
}
class _AltHeld extends HardwareKeyboard {
@override
bool get isAltPressed => true;
@override
bool get isControlPressed => false;
@override
bool get isMetaPressed => false;
@override
bool get isShiftPressed => false;
}