Reserve global shortcuts for chat selection and search

This commit is contained in:
2026-11-06 17:58:12 +00:00
parent 51ee950a5b
commit f668e1eef8
12 changed files with 412 additions and 172 deletions
+8 -1
View File
@@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
import '../../core/api_gateway.dart';
import '../../shell/shell_bar.dart';
import '../../shell/shell_search_focus.dart';
import '../../ui/adaptive/host.dart';
import '../../ui/adaptive/segmented_bar.dart';
import 'data/search_repository.dart';
@@ -44,6 +45,7 @@ class SearchScreen extends StatefulWidget {
class _SearchScreenState extends State<SearchScreen> {
late final OmniSearchController _controller;
late final TextEditingController _text;
final FocusNode _focus = FocusNode(debugLabel: 'omni-search');
@override
void initState() {
@@ -76,11 +78,15 @@ class _SearchScreenState extends State<SearchScreen> {
_controller.removeListener(_onState);
_controller.dispose();
_text.dispose();
_focus.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
Widget build(BuildContext context) =>
ShellSearchShortcut(onFocus: _focus.requestFocus, child: _build(context));
Widget _build(BuildContext context) {
// Follow the actual host app class: Cupertino only under an explicit
// Cupertino host, Material on every platform otherwise.
final cupertino = widget.cupertino ?? usesCupertinoHost(context);
@@ -112,6 +118,7 @@ class _SearchScreenState extends State<SearchScreen> {
}
Widget _controls(bool cupertino) => SearchBarControls(
focusNode: _focus,
cupertino: cupertino,
text: _text,
kind: _controller.parsed.kind,
@@ -29,6 +29,7 @@ class SearchBarControls extends StatelessWidget {
required this.onCleared,
required this.onKind,
this.autofocus = true,
this.focusNode,
});
final bool cupertino;
@@ -39,6 +40,7 @@ class SearchBarControls extends StatelessWidget {
final VoidCallback onCleared;
final ValueChanged<SearchKind> onKind;
final bool autofocus;
final FocusNode? focusNode;
@override
// The pill grows with the bar, so the field and the results share both
@@ -55,6 +57,7 @@ class SearchBarControls extends StatelessWidget {
clearKey: const ValueKey('search.clear'),
controller: text,
autofocus: autofocus,
focusNode: focusNode,
inBar: true,
cupertino: cupertino,
placeholder: 'Search pipelines, runs, artifacts and chats',
+16 -26
View File
@@ -273,34 +273,24 @@ class _AdaptiveShellState extends State<AdaptiveShell> {
if (previous != null) _select(previous);
}
/// Handles this before focused text controls can insert or traverse on
/// Ctrl+Tab. The handler is scoped to the shell's lifetime, not onboarding.
///
/// Ctrl+1…Ctrl+9 open the Nth item of the open tab's list the same way, in
/// the list's on-screen order; a page (Settings) has no list.
/// App-wide search and conversation-list selection are handled before text
/// fields. Split-pane navigation belongs to the chat workspace; tab changes
/// have no global keyboard chord.
bool _handleDestinationKeyEvent(KeyEvent event) {
final listIndex = shellListShortcutIndex(
event,
HardwareKeyboard.instance,
);
if (listIndex != null) {
if (!shellTabDestinations.contains(_selected)) return false;
return _bar.lists.open(_selected, listIndex);
final keyboard = HardwareKeyboard.instance;
if (shellSearchShortcut(event, keyboard)) {
_select(AppDestination.search);
WidgetsBinding.instance.addPostFrameCallback((_) {
if (mounted && _selected == AppDestination.search) {
_bar.searchFocus.request();
}
});
WidgetsBinding.instance.ensureVisualUpdate();
return true;
}
if (event is! KeyDownEvent ||
event.logicalKey != LogicalKeyboardKey.tab ||
!HardwareKeyboard.instance.isControlPressed) {
return false;
}
final current = shellTabDestinations.indexOf(shellTabFor(_selected));
final direction = HardwareKeyboard.instance.isShiftPressed ? -1 : 1;
final next = (current + direction) % shellTabDestinations.length;
_select(
shellTabDestinations[next < 0
? next + shellTabDestinations.length
: next],
);
return true;
final listIndex = shellListShortcutIndex(event, keyboard);
if (listIndex == null || _selected != AppDestination.chat) return false;
return _bar.lists.open(AppDestination.chat, listIndex);
}
List<FloatingDestinationItem> _destinationItems() =>
+4 -1
View File
@@ -2,6 +2,7 @@ import 'package:flutter/widgets.dart';
import 'destination.dart';
import 'shell_list_shortcuts.dart';
import 'shell_search_focus.dart';
/// What the open screen of a tab puts in the app bar: its title, a Back
/// control and its actions. Absent, the bar shows the tab's own name.
@@ -66,9 +67,11 @@ class ShellBarRegistry extends ChangeNotifier {
final _Notifier _bar = _Notifier();
final _Notifier _badgeNotifier = _Notifier();
/// How each tab's list opens its Nth item (Ctrl+1…Ctrl+9).
/// Registered list openers; keyboard shortcuts invoke Chat only.
final ShellListShortcuts lists = ShellListShortcuts();
final ShellSearchFocus searchFocus = ShellSearchFocus();
/// The destination whose bar is on screen; null treats every destination
/// as shown. Bar changes of other destinations are kept without notifying:
/// the host rebuilds when it changes the focus.
+28 -11
View File
@@ -5,9 +5,9 @@ import 'package:flutter/widgets.dart';
import 'destination.dart';
import 'shell_bar.dart';
/// Opens the Nth item of a tab's list: what each tab's list screen published
/// for Ctrl+1…Ctrl+9 (also Command on macOS). One opener per tab;
/// the latest mounted list wins.
/// List openers registered by destination. The shell invokes only Chat for
/// Ctrl+1…Ctrl+9 (also Command on macOS); Pipelines and Runs have no chord.
/// One opener per destination; the latest mounted list wins.
class ShellListShortcuts {
final Map<AppDestination, (Object, bool Function(int index))> _openers = {};
@@ -34,13 +34,8 @@ int? shellListShortcutIndex(
HardwareKeyboard keyboard, {
TargetPlatform? platform,
}) {
final control = keyboard.isControlPressed && !keyboard.isMetaPressed;
final command =
(platform ?? defaultTargetPlatform) == TargetPlatform.macOS &&
keyboard.isMetaPressed &&
!keyboard.isControlPressed;
if (event is! KeyDownEvent ||
!(control || command) ||
!shellPrimaryModifier(keyboard, platform: platform) ||
keyboard.isShiftPressed ||
keyboard.isAltPressed) {
return null;
@@ -49,6 +44,28 @@ int? shellListShortcutIndex(
return index < 0 ? null : index;
}
/// Ctrl on any host, or Command on the actual macOS host. Theme overrides do
/// not change keyboard conventions in a browser.
bool shellPrimaryModifier(
HardwareKeyboard keyboard, {
TargetPlatform? platform,
}) =>
(keyboard.isControlPressed && !keyboard.isMetaPressed) ||
((platform ?? defaultTargetPlatform) == TargetPlatform.macOS &&
keyboard.isMetaPressed &&
!keyboard.isControlPressed);
bool shellSearchShortcut(
KeyEvent event,
HardwareKeyboard keyboard, {
TargetPlatform? platform,
}) =>
event is KeyDownEvent &&
event.logicalKey == LogicalKeyboardKey.slash &&
shellPrimaryModifier(keyboard, platform: platform) &&
!keyboard.isAltPressed &&
!keyboard.isShiftPressed;
const _digits = [
LogicalKeyboardKey.digit1,
LogicalKeyboardKey.digit2,
@@ -62,8 +79,8 @@ const _digits = [
];
/// Publishes, while mounted, how its tab's list opens its Nth item, so the
/// shell's Ctrl+1…Ctrl+9 open it from anywhere in the tab (also while a text
/// field has focus). [onOpenIndex] reads the list at key time, in on-screen
/// shell can open an item without coupling to its screen (also while a text
/// field has focus). Keyboard dispatch currently invokes only Chat. [onOpenIndex] reads the list at key time, in on-screen
/// order, and reports whether an item was opened. Outside a shell it does
/// nothing.
class ShellListShortcut extends StatefulWidget {
+62
View File
@@ -0,0 +1,62 @@
import 'package:flutter/widgets.dart';
import 'destination.dart';
import 'shell_bar.dart';
/// The mounted Search screen publishes its field focus without clearing query
/// state. The shell requests it after switching destinations has settled.
class ShellSearchFocus {
Object? _owner;
VoidCallback? _focus;
void request() => _focus?.call();
void _set(Object owner, VoidCallback focus) {
_owner = owner;
_focus = focus;
}
void _clear(Object owner) {
if (_owner != owner) return;
_owner = null;
_focus = null;
}
}
class ShellSearchShortcut extends StatefulWidget {
const ShellSearchShortcut({
super.key,
required this.onFocus,
required this.child,
});
final VoidCallback onFocus;
final Widget child;
@override
State<ShellSearchShortcut> createState() => _ShellSearchShortcutState();
}
class _ShellSearchShortcutState extends State<ShellSearchShortcut> {
final _owner = Object();
ShellBarScope? _scope;
@override
void didChangeDependencies() {
super.didChangeDependencies();
final scope = ShellBarScope.maybeOf(context);
if (scope == _scope) return;
_scope?.registry.searchFocus._clear(_owner);
_scope = scope;
if (scope?.destination == AppDestination.search) {
scope!.registry.searchFocus._set(_owner, () => widget.onFocus());
}
}
@override
void dispose() {
_scope?.registry.searchFocus._clear(_owner);
super.dispose();
}
@override
Widget build(BuildContext context) => widget.child;
}
+1 -1
View File
@@ -2,7 +2,7 @@ import 'destination.dart';
/// The tabs the operator left, most recent first, for the system Back.
///
/// Every tab change (a tap, Ctrl+Tab, a search result or notification opening
/// Every tab change (a tap, a search result or notification opening
/// another tab) goes through [record]: the tab being left moves to the top
/// and the tab being opened leaves the stack, so each tab appears at most once
/// and the current tab is never in it. A page that belongs to a tab
@@ -0,0 +1,7 @@
# Chat workspace keyboard remapping
Ctrl+/ opens the persistent Search tab and focuses its existing field. On the actual macOS host Command+/ does the same, even when web Material theme advertises Android. Repeating the chord refocuses Search without resetting its query or filter. The search screen owns and disposes its field FocusNode and publishes a scoped callback to the shell; the callback is requested after the destination transition rebuild.
Ctrl+1…9 and macOS Command+1…9 still choose conversation rows, in the visible list order. Pipelines and Runs no longer receive digit shortcuts. Ctrl+Tab and Ctrl+Shift+Tab no longer switch destinations; workspace pane navigation is handled separately. Extra Shift/Alt or combined Ctrl+Command modifiers pass through for both Search and digit selection. No socket or backend changes.
Checks: bounded analysis clean. 188 shell/Search tests passed through the memory watchdog (peak1713MB,14s). Tests cover exact modifiers on macOS/Windows, actual SearchScreen focus from a composer, repeat/revisit retaining query, Android-theme/macOS-host mismatch, chat-only digits, unchanged destination/history for removed chords, and normal Tab traversal. Browser interaction for the full split workspace is recorded by the parent integration task; this lane has no visual layout change.
+74 -72
View File
@@ -9,81 +9,83 @@ void main() {
for (final cupertino in [false, true]) {
final host = cupertino ? 'Cupertino' : 'Material';
testWidgets('$host Ctrl+Tab changes destinations and wraps from the ends', (
tester,
) async {
final app = AdaptiveShell(
cupertino: cupertino,
destinationBodies: {
for (final destination in shellTabDestinations)
destination: (_) => Focus(
autofocus: destination == AppDestination.pipelines,
child: Text(destination.name),
),
},
);
await tester.pumpWidget(
cupertino ? CupertinoApp(home: app) : MaterialApp(home: app),
);
testWidgets(
'$host Ctrl+Tab and Ctrl+Shift+Tab leave destinations unchanged',
(tester) async {
final app = AdaptiveShell(
cupertino: cupertino,
destinationBodies: {
for (final destination in shellTabDestinations)
destination: (_) => Focus(
autofocus: destination == AppDestination.pipelines,
child: Text(destination.name),
),
},
);
await tester.pumpWidget(
cupertino ? CupertinoApp(home: app) : MaterialApp(home: app),
);
Future<void> press({required bool shift}) async {
await tester.sendKeyDownEvent(LogicalKeyboardKey.controlLeft);
if (shift) await tester.sendKeyDownEvent(LogicalKeyboardKey.shiftLeft);
Future<void> press({required bool shift}) async {
await tester.sendKeyDownEvent(LogicalKeyboardKey.controlLeft);
if (shift)
await tester.sendKeyDownEvent(LogicalKeyboardKey.shiftLeft);
await tester.sendKeyEvent(LogicalKeyboardKey.tab);
if (shift) await tester.sendKeyUpEvent(LogicalKeyboardKey.shiftLeft);
await tester.sendKeyUpEvent(LogicalKeyboardKey.controlLeft);
await tester.pump();
}
expect(find.text('pipelines'), findsOneWidget);
await press(shift: true);
expect(find.text('pipelines'), findsOneWidget);
await press(shift: false);
expect(find.text('pipelines'), findsOneWidget);
},
);
testWidgets(
'$host plain Tab traverses and Ctrl+Tab does not change destinations',
(tester) async {
final first = FocusNode();
final second = FocusNode();
addTearDown(first.dispose);
addTearDown(second.dispose);
final app = AdaptiveShell(
cupertino: cupertino,
destinationBodies: {
AppDestination.pipelines: (_) => Column(
children: [
cupertino
? CupertinoTextField(focusNode: first)
: TextField(focusNode: first),
cupertino
? CupertinoTextField(focusNode: second)
: TextField(focusNode: second),
],
),
AppDestination.runs: (_) => const Text('runs'),
},
);
await tester.pumpWidget(
cupertino ? CupertinoApp(home: app) : MaterialApp(home: app),
);
first.requestFocus();
await tester.pump();
// Plain Tab retains normal traversal semantics and does not select a tab.
await tester.sendKeyEvent(LogicalKeyboardKey.tab);
await tester.pump();
expect(second.hasFocus, isTrue);
first.requestFocus();
await tester.pump();
await tester.sendKeyDownEvent(LogicalKeyboardKey.controlLeft);
await tester.sendKeyEvent(LogicalKeyboardKey.tab);
if (shift) await tester.sendKeyUpEvent(LogicalKeyboardKey.shiftLeft);
await tester.sendKeyUpEvent(LogicalKeyboardKey.controlLeft);
await tester.pump();
}
expect(find.text('pipelines'), findsOneWidget);
await press(shift: true);
expect(find.text('search'), findsOneWidget);
await press(shift: false);
expect(find.text('pipelines'), findsOneWidget);
});
testWidgets('$host Ctrl+Tab works in a text field and plain Tab traverses', (
tester,
) async {
final first = FocusNode();
final second = FocusNode();
addTearDown(first.dispose);
addTearDown(second.dispose);
final app = AdaptiveShell(
cupertino: cupertino,
destinationBodies: {
AppDestination.pipelines: (_) => Column(
children: [
cupertino
? CupertinoTextField(focusNode: first)
: TextField(focusNode: first),
cupertino
? CupertinoTextField(focusNode: second)
: TextField(focusNode: second),
],
),
AppDestination.runs: (_) => const Text('runs'),
},
);
await tester.pumpWidget(
cupertino ? CupertinoApp(home: app) : MaterialApp(home: app),
);
first.requestFocus();
await tester.pump();
// Plain Tab retains normal traversal semantics and does not select a tab.
await tester.sendKeyEvent(LogicalKeyboardKey.tab);
await tester.pump();
expect(second.hasFocus, isTrue);
first.requestFocus();
await tester.pump();
await tester.sendKeyDownEvent(LogicalKeyboardKey.controlLeft);
await tester.sendKeyEvent(LogicalKeyboardKey.tab);
await tester.sendKeyUpEvent(LogicalKeyboardKey.controlLeft);
await tester.pump();
expect(find.text('runs'), findsOneWidget);
expect(first.hasFocus, isFalse);
});
expect(find.text('runs'), findsNothing);
},
);
}
}
+72 -57
View File
@@ -51,65 +51,80 @@ void main() {
});
}
testWidgets('Ctrl+1…9 reach only the open tab\'s list; other chords pass', (
tester,
) async {
final opened = <(AppDestination, int)>[];
final field = FocusNode();
addTearDown(field.dispose);
Widget list(AppDestination destination) => ShellListShortcut(
onOpenIndex: (index) {
if (index > 4) return false;
opened.add((destination, index));
return true;
},
child: TextField(focusNode: field),
);
await tester.pumpWidget(
MaterialApp(
home: AdaptiveShell(
destination: AppDestination.runs,
destinationBodies: {
AppDestination.runs: (_) => list(AppDestination.runs),
AppDestination.pipelines: (_) => list(AppDestination.pipelines),
},
testWidgets(
'Ctrl+1…9 select chat rows only; other destinations and chords pass',
(tester) async {
final opened = <(AppDestination, int)>[];
final field = FocusNode();
addTearDown(field.dispose);
Widget list(AppDestination destination) => ShellListShortcut(
onOpenIndex: (index) {
if (index > 4) return false;
opened.add((destination, index));
return true;
},
child: destination == AppDestination.runs
? TextField(focusNode: field)
: const SizedBox.shrink(),
);
await tester.pumpWidget(
MaterialApp(
home: AdaptiveShell(
destination: AppDestination.runs,
destinationBodies: {
AppDestination.runs: (_) => list(AppDestination.runs),
AppDestination.pipelines: (_) => list(AppDestination.pipelines),
AppDestination.chat: (_) => list(AppDestination.chat),
},
),
),
),
);
await tester.pumpAndSettle();
field.requestFocus();
await tester.pump();
Future<void> press(
LogicalKeyboardKey key, {
List<LogicalKeyboardKey> held = const [LogicalKeyboardKey.controlLeft],
}) async {
for (final modifier in held) {
await tester.sendKeyDownEvent(modifier);
}
await tester.sendKeyEvent(key);
for (final modifier in held.reversed) {
await tester.sendKeyUpEvent(modifier);
}
);
await tester.pumpAndSettle();
field.requestFocus();
await tester.pump();
}
await press(LogicalKeyboardKey.digit1);
await press(LogicalKeyboardKey.digit5);
expect(opened, [(AppDestination.runs, 0), (AppDestination.runs, 4)]);
Future<void> press(
LogicalKeyboardKey key, {
List<LogicalKeyboardKey> held = const [LogicalKeyboardKey.controlLeft],
}) async {
for (final modifier in held) {
await tester.sendKeyDownEvent(modifier);
}
await tester.sendKeyEvent(key);
for (final modifier in held.reversed) {
await tester.sendKeyUpEvent(modifier);
}
await tester.pump();
}
opened.clear();
await press(
LogicalKeyboardKey.digit2,
held: [LogicalKeyboardKey.controlLeft, LogicalKeyboardKey.shiftLeft],
);
await press(
LogicalKeyboardKey.digit2,
held: [LogicalKeyboardKey.controlLeft, LogicalKeyboardKey.metaLeft],
);
await press(LogicalKeyboardKey.digit2, held: const []);
await press(LogicalKeyboardKey.digit0);
expect(opened, isEmpty);
expect(field.hasFocus, isTrue);
});
await press(LogicalKeyboardKey.digit1);
await press(LogicalKeyboardKey.digit5);
expect(opened, isEmpty);
await tester.tap(
find.byKey(const ValueKey('shell.destination.pipelines')),
);
await tester.pumpAndSettle();
await press(LogicalKeyboardKey.digit1);
expect(opened, isEmpty);
await tester.tap(find.byKey(const ValueKey('shell.destination.chat')));
await tester.pumpAndSettle();
await press(LogicalKeyboardKey.digit1);
await press(LogicalKeyboardKey.digit5);
expect(opened, [(AppDestination.chat, 0), (AppDestination.chat, 4)]);
opened.clear();
await press(
LogicalKeyboardKey.digit2,
held: [LogicalKeyboardKey.controlLeft, LogicalKeyboardKey.shiftLeft],
);
await press(
LogicalKeyboardKey.digit2,
held: [LogicalKeyboardKey.controlLeft, LogicalKeyboardKey.metaLeft],
);
await press(LogicalKeyboardKey.digit2, held: const []);
await press(LogicalKeyboardKey.digit0);
expect(opened, isEmpty);
expect(opened, isEmpty);
},
);
}
+132
View File
@@ -0,0 +1,132 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:pipelines_app/core/api_gateway.dart';
import 'package:pipelines_app/features/search/search_screen.dart';
import 'package:pipelines_app/features/search/ui/search_bar_controls.dart';
import 'package:pipelines_app/shell/adaptive_shell.dart';
import 'package:pipelines_app/shell/destination.dart';
import 'package:pipelines_app/shell/shell_list_shortcuts.dart';
class _Gateway implements ApiGateway {
@override
Stream<JsonMap> get frames => const Stream.empty();
@override
Future<JsonMap> call(String type, [JsonMap fields = const {}]) async => {
'search_results': {'results': [], 'truncated': false},
};
}
Future<void> _chord(
WidgetTester tester,
List<LogicalKeyboardKey> modifiers,
LogicalKeyboardKey key,
) async {
for (final modifier in modifiers) {
await tester.sendKeyDownEvent(modifier);
}
await tester.sendKeyEvent(key);
for (final modifier in modifiers.reversed) {
await tester.sendKeyUpEvent(modifier);
}
await tester.pumpAndSettle();
}
void main() {
for (final platform in [TargetPlatform.macOS, TargetPlatform.windows]) {
testWidgets('Search accepts exact primary slash on $platform', (
tester,
) async {
final results = <bool>[];
bool handler(KeyEvent event) {
if (event is KeyDownEvent &&
event.logicalKey == LogicalKeyboardKey.slash) {
results.add(
shellSearchShortcut(
event,
HardwareKeyboard.instance,
platform: platform,
),
);
}
return false;
}
HardwareKeyboard.instance.addHandler(handler);
addTearDown(() => HardwareKeyboard.instance.removeHandler(handler));
for (final modifiers in [
[LogicalKeyboardKey.controlLeft],
[LogicalKeyboardKey.metaLeft],
[LogicalKeyboardKey.controlLeft, LogicalKeyboardKey.shiftLeft],
[LogicalKeyboardKey.controlLeft, LogicalKeyboardKey.altLeft],
[LogicalKeyboardKey.controlLeft, LogicalKeyboardKey.metaLeft],
<LogicalKeyboardKey>[],
]) {
await _chord(tester, modifiers, LogicalKeyboardKey.slash);
}
expect(results, [
true,
platform == TargetPlatform.macOS,
false,
false,
false,
false,
]);
});
}
for (final platform in [TargetPlatform.macOS, TargetPlatform.windows]) {
testWidgets(
'Search chord opens and refocuses retained query on $platform',
(tester) async {
final composer = TextEditingController(text: 'draft remains');
final focus = FocusNode();
addTearDown(composer.dispose);
addTearDown(focus.dispose);
await tester.pumpWidget(
MaterialApp(
// The theme deliberately disagrees with the actual macOS host.
theme: ThemeData(platform: TargetPlatform.android),
home: AdaptiveShell(
destination: AppDestination.chat,
destinationBodies: {
AppDestination.chat: (_) =>
TextField(controller: composer, focusNode: focus),
AppDestination.search: (_) => SearchScreen(
gateway: _Gateway(),
onOpen: (_) {},
embedded: true,
),
},
),
),
);
await tester.pumpAndSettle();
focus.requestFocus();
await tester.pump();
final primary = platform == TargetPlatform.macOS
? LogicalKeyboardKey.metaLeft
: LogicalKeyboardKey.controlLeft;
await _chord(tester, [primary], LogicalKeyboardKey.slash);
var search = tester.widget<TextField>(find.byKey(searchFieldKey));
expect(search.focusNode!.hasFocus, isTrue);
expect(composer.text, 'draft remains');
await tester.enterText(find.byKey(searchFieldKey), 'release');
await tester.pumpAndSettle(const Duration(milliseconds: 300));
await tester.tap(find.byKey(const ValueKey('shell.destination.chat')));
await tester.pumpAndSettle();
focus.requestFocus();
await tester.pump();
await _chord(tester, [primary], LogicalKeyboardKey.slash);
search = tester.widget<TextField>(find.byKey(searchFieldKey));
expect(search.controller!.text, 'release');
expect(search.focusNode!.hasFocus, isTrue);
search.focusNode!.unfocus();
await tester.pump();
await _chord(tester, [primary], LogicalKeyboardKey.slash);
expect(search.focusNode!.hasFocus, isTrue);
},
variant: TargetPlatformVariant.only(platform),
);
}
}
+5 -3
View File
@@ -99,7 +99,9 @@ void main() {
expect(exits, ['SystemNavigator.pop']);
});
testWidgets('Ctrl+Tab tab changes are part of the history', (tester) async {
testWidgets('Ctrl+Tab no longer switches destinations or changes history', (
tester,
) async {
final exits = _recordExits(tester);
await tester.pumpWidget(
MaterialApp(home: AdaptiveShell(destinationBodies: _bodies())),
@@ -108,11 +110,11 @@ void main() {
await tester.sendKeyEvent(LogicalKeyboardKey.tab);
await tester.sendKeyUpEvent(LogicalKeyboardKey.controlLeft);
await tester.pumpAndSettle();
_expectShown(AppDestination.runs);
_expectShown(AppDestination.pipelines);
await _back(tester);
_expectShown(AppDestination.pipelines);
expect(exits, isEmpty);
expect(exits, ['SystemNavigator.pop']);
});
testWidgets('a page open in the tab closes before Back changes tabs', (