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
+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;
}