Skip to content

The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.

Web: a phone's search is a list, then a row's details behind a Back (#1779)

0xdiego2589b8db94460e
diff --git a/desktop/lib/screens/swarm_screen.dart b/desktop/lib/screens/swarm_screen.dart
index 597c12e84..8feb49ef5 100644
--- a/desktop/lib/screens/swarm_screen.dart
+++ b/desktop/lib/screens/swarm_screen.dart
@@ -6808,8 +6808,11 @@ class _SwarmScreenState extends State<SwarmScreen> {
return;
}
if (choice.destination.isModel) return;
- if (_search!.setupLayout &&
- (choice.destination.isMachine || choice.destination.isAccountDevice)) {
+ // A machine, a device or Add machine is chosen to use its preview's actions: the click lands on
+ // the row it clicked, and the keys go to those actions. Focusing the actions alone left the
+ // row selected before it in charge, so clicking Add machine after a machine did nothing
+ // (2026-10-15). A phone shows the same row's page (swarmSearchRowSelectsOnly).
+ if (swarmSearchRowSelectsOnly(_search!, choice.destination)) {
final index = _search!.rows.indexWhere(
(row) => row.id == choice.destination.id,
);
@@ -6838,21 +6841,6 @@ class _SwarmScreenState extends State<SwarmScreen> {
return;
}
if (choice.destination.isCreate) {
- if (_search!.isMachineMode) {
- // A click lands on the row it clicked, as a machine row's does: focusing the actions alone
- // left the machine selected before it in charge, so clicking Add machine after a machine
- // did nothing (2026-10-15).
- final index = _search!.rows.indexWhere(
- (row) => row.id == choice.destination.id,
- );
- if (index >= 0) _search!.move(index - _search!.cursor);
- WidgetsBinding.instance.addPostFrameCallback((_) {
- if (mounted && _search?.selected?.id == choice.destination.id) {
- _previewControls.invoke('picker.focus_actions');
- }
- });
- return;
- }
if (_search!.isModelMode) {
_previewControls.invoke('picker.resource_add_api');
return;
diff --git a/desktop/lib/widgets/desktop_search_pages.dart b/desktop/lib/widgets/desktop_search_pages.dart
new file mode 100644
index 000000000..01e9342f9
--- /dev/null
+++ b/desktop/lib/widgets/desktop_search_pages.dart
@@ -0,0 +1,373 @@
+part of 'desktop_search_panel.dart';
+
+/// A phone's search as two pages, as an iPhone app's list and its detail: the
+/// results alone, then the selected row's preview with a Back (owner,
+/// 2026-10-27, on '@' Machines at 390 px: "split it into slides instead of
+/// stacking two blocks"). Which rows drill in and which act at once is
+/// [swarmSearchRowSelectsOnly]'s rule.
+///
+/// The details page is a view of the search's selected row, not a second
+/// selection: it remembers only which row it was opened on, and goes back to
+/// the list when the query or the selection moves on. Both pages stay built —
+/// the list keeps its scroll, the preview keeps answering its commands — and
+/// the one out of sight is offstage, out of focus and of the pointer's way.
+///
+/// A wider window builds the panel through here too, so that crossing the
+/// width keeps the search field; it pages nothing and keys behave as before.
+class _SearchPages extends StatefulWidget {
+ const _SearchPages({
+ required this.search,
+ required this.onChoose,
+ required this.onRefocus,
+ required this.builder,
+ });
+
+ final SwarmSearchController search;
+ final ValueChanged<SwarmSearchSelection> onChoose;
+ final VoidCallback onRefocus;
+ final Widget Function(BuildContext context, _SearchPagesState? pages) builder;
+
+ @override
+ State<_SearchPages> createState() => _SearchPagesState();
+}
+
+class _SearchPagesState extends State<_SearchPages>
+ with SingleTickerProviderStateMixin {
+ static const _duration = Duration(milliseconds: 250);
+
+ /// How far in from the page's left edge a swipe back may start.
+ static const _edge = 20.0;
+
+ // 0 shows the list, 1 the details.
+ late final _slide = AnimationController(vsync: this, duration: _duration);
+
+ /// The row and query the details page was opened on; null on the list.
+ ({String row, String query})? _opened;
+
+ /// Where a tap back to the list leaves the keys: in the search, out of its
+ /// field, so a phone's keyboard does not rise over the list.
+ final _keys = FocusNode(debugLabel: 'Search pages', skipTraversal: true);
+ bool _phone = false;
+
+ SwarmSearchController get search => widget.search;
+
+ @override
+ void initState() {
+ super.initState();
+ search.addListener(_searchChanged);
+ }
+
+ @override
+ void didUpdateWidget(_SearchPages oldWidget) {
+ super.didUpdateWidget(oldWidget);
+ if (oldWidget.search != search) {
+ oldWidget.search.removeListener(_searchChanged);
+ search.addListener(_searchChanged);
+ _leave(animate: false, focus: _Return.stay);
+ }
+ }
+
+ @override
+ void dispose() {
+ search.removeListener(_searchChanged);
+ _keys.dispose();
+ _slide.dispose();
+ super.dispose();
+ }
+
+ // Typing, a scope, or a selection that moved on (a removed machine, an
+ // arrow key) is the list's again.
+ void _searchChanged() {
+ final opened = _opened;
+ if (opened == null) return;
+ if (search.query != opened.query || search.selected?.id != opened.row) {
+ _leave(animate: false, focus: _Return.stay);
+ }
+ }
+
+ void _go(double page, {bool animate = true}) {
+ if (!animate || MediaQuery.disableAnimationsOf(context)) {
+ _slide.value = page;
+ } else {
+ _slide.animateTo(page, curve: Curves.easeOutCubic);
+ }
+ }
+
+ /// Opens [row]'s details: the search's selection, which the caller has
+ /// already moved there.
+ void show(SwarmDestination row) {
+ if (!mounted || !_phone) return;
+ setState(() => _opened = (row: row.id, query: search.query));
+ _go(1);
+ }
+
+ /// A row's tap or Return: what it does anywhere, then, on a phone, its
+ /// details when it is a row that drills in.
+ void choose(SwarmSearchSelection choice) {
+ // The choice moves the selection to the row before it returns.
+ widget.onChoose(choice);
+ if (swarmSearchRowSelectsOnly(search, choice.destination)) {
+ show(choice.destination);
+ }
+ }
+
+ void _leave({bool animate = true, _Return focus = _Return.list}) {
+ if (_opened == null) return;
+ setState(() => _opened = null);
+ _go(0, animate: animate);
+ switch (focus) {
+ case _Return.field:
+ widget.onRefocus();
+ case _Return.list:
+ _keys.requestFocus();
+ case _Return.stay:
+ break;
+ }
+ }
+
+ void _swipe(DragUpdateDetails details, double width) {
+ if (_opened == null || width <= 0) return;
+ _slide.value -= (details.primaryDelta ?? 0) / width;
+ }
+
+ void _swipeEnd(DragEndDetails details) {
+ if (_opened == null) return;
+ if ((details.primaryVelocity ?? 0) > 300 || _slide.value < .6) {
+ _leave();
+ } else {
+ _go(1);
+ }
+ }
+
+ /// The two pages, sliding as one: [list], and the details page around
+ /// [preview] — built only while the search has a preview to show, as the
+ /// side-by-side panel builds it, since the workspace keeps an offstage one
+ /// otherwise.
+ Widget view({required Widget list, required Widget Function() preview}) {
+ final details = Column(
+ crossAxisAlignment: CrossAxisAlignment.stretch,
+ children: [
+ _DetailsBar(search: search, onBack: _leave),
+ Divider(height: 1, color: DesktopChrome.rim),
+ Expanded(
+ child: ListenableBuilder(
+ listenable: search,
+ builder: (context, _) => search.hasPreview && !search.showsTypeHints
+ ? preview()
+ : const SizedBox.shrink(),
+ ),
+ ),
+ ],
+ );
+ return LayoutBuilder(
+ builder: (context, constraints) => ClipRect(
+ child: AnimatedBuilder(
+ animation: _slide,
+ builder: (context, _) {
+ final page = _slide.value;
+ final opened = _opened != null;
+ return Stack(
+ children: [
+ _page(
+ list,
+ offset: -page * .3,
+ shown: page < 1 || !opened,
+ on: !opened,
+ ),
+ _page(
+ Stack(
+ children: [
+ Positioned.fill(child: details),
+ // A right swipe from the left edge goes back. Only the
+ // edge: the preview's own drags stay its own.
+ Positioned(
+ left: 0,
+ top: 0,
+ bottom: 0,
+ width: _edge,
+ child: GestureDetector(
+ key: const ValueKey('search-details-edge'),
+ behavior: HitTestBehavior.translucent,
+ onHorizontalDragUpdate: (details) =>
+ _swipe(details, constraints.maxWidth),
+ onHorizontalDragEnd: _swipeEnd,
+ ),
+ ),
+ ],
+ ),
+ offset: 1 - page,
+ shown: page > 0 || opened,
+ on: opened,
+ ),
+ ],
+ );
+ },
+ ),
+ ),
+ );
+ }
+
+ Widget _page(
+ Widget child, {
+ required double offset,
+ required bool shown,
+ required bool on,
+ }) => Positioned.fill(
+ child: Offstage(
+ offstage: !shown,
+ child: TickerMode(
+ enabled: shown,
+ child: IgnorePointer(
+ ignoring: !on,
+ child: ExcludeSemantics(
+ excluding: !on,
+ child: ExcludeFocus(
+ excluding: !on,
+ child: FractionalTranslation(
+ translation: Offset(offset, 0),
+ child: child,
+ ),
+ ),
+ ),
+ ),
+ ),
+ ),
+ );
+
+ @override
+ void didChangeDependencies() {
+ super.didChangeDependencies();
+ final phone = workspaceIsCompact(context);
+ if (phone == _phone) return;
+ _phone = phone;
+ if (!phone) {
+ // Crossing to a wider window shows the list and preview together again.
+ _opened = null;
+ _slide.value = 0;
+ } else if (!search.previewVisible) {
+ // A phone's preview is a page with no toggle: a preview hidden on a
+ // wider window would leave every details page blank.
+ WidgetsBinding.instance.addPostFrameCallback((_) {
+ if (mounted && _phone && !search.previewVisible) search.togglePreview();
+ });
+ }
+ }
+
+ /// After a key chose [row] the way a tap does, shows its page when it is a
+ /// row that drills in.
+ void _chose(SwarmDestination? row) {
+ if (row != null &&
+ search.selected?.id == row.id &&
+ swarmSearchRowSelectsOnly(search, row)) {
+ show(row);
+ }
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ final parent = KeymapRegion.of(context);
+ // Keys only: it adds nothing to the accessibility tree.
+ final panel = Focus(
+ focusNode: _keys,
+ includeSemantics: false,
+ child: widget.builder(context, _phone ? this : null),
+ );
+ if (parent == null) return panel;
+ final actions = parent.actions ?? const <String, VoidCallback>{};
+ return KeymapRegion(
+ contextKind: parent.contextKind,
+ composing: parent.composing,
+ actions: {
+ ...actions,
+ // Escape on the details page goes back to the list; a form open
+ // in the preview (Rename…) still takes it first.
+ 'picker.cancel': () {
+ if (_opened != null && !resourcePreviewFormFocused()) {
+ _leave(focus: _Return.field);
+ } else {
+ actions['picker.cancel']?.call();
+ }
+ },
+ // Return and a row's number choose as before; on a phone, a row
+ // that drills in then shows its details, as its tap does.
+ 'picker.accept': () {
+ final row = _opened == null ? search.selected : null;
+ actions['picker.accept']?.call();
+ _chose(row);
+ },
+ for (var number = 1; number <= 9; number++)
+ if (actions['picker.pick_$number'] case final pick?)
+ 'picker.pick_$number': () {
+ final rows = search.rows;
+ pick();
+ _chose(number <= rows.length ? rows[number - 1] : null);
+ },
+ // A phone's preview stays on: it is the details page.
+ if (actions['picker.toggle_preview'] case final toggle?)
+ 'picker.toggle_preview': () {
+ if (!_phone) toggle();
+ },
+ },
+ child: panel,
+ );
+ }
+}
+
+/// Where focus goes when the details page goes back to the list.
+enum _Return {
+ /// The search field: Escape, a key path, goes on typing.
+ field,
+
+ /// The search, out of its field: a tap or a swipe.
+ list,
+
+ /// Nowhere new: the query or selection that closed the page has it.
+ stay,
+}
+
+/// The details page's top: a finger-sized Back, and the row it shows.
+class _DetailsBar extends StatelessWidget {
+ const _DetailsBar({required this.search, required this.onBack});
+
+ final SwarmSearchController search;
+ final VoidCallback onBack;
+
+ @override
+ Widget build(BuildContext context) => Padding(
+ padding: const EdgeInsets.fromLTRB(8, 0, 20, 6),
+ child: Row(
+ children: [
+ TextButton.icon(
+ key: const ValueKey('search-details-back'),
+ onPressed: onBack,
+ style: TextButton.styleFrom(
+ minimumSize: const Size(kFingerTarget, kFingerTarget),
+ padding: const EdgeInsets.fromLTRB(6, 0, 12, 0),
+ foregroundColor: DesktopChrome.foreground,
+ ),
+ icon: const Icon(AppIcons.chevronLeft, size: 20),
+ label: Text(
+ 'Back',
+ style: DesktopChrome.text(size: 14, medium: true),
+ ),
+ ),
+ const SizedBox(width: 6),
+ Expanded(
+ child: ListenableBuilder(
+ listenable: search,
+ builder: (context, _) => Semantics(
+ header: true,
+ child: Text(
+ search.selected?.title ?? '',
+ key: const ValueKey('search-details-title'),
+ maxLines: 1,
+ overflow: TextOverflow.ellipsis,
+ style: DesktopChrome.text(size: 15, medium: true),
+ ),
+ ),
+ ),
+ ),
+ ],
+ ),
+ );
+}
diff --git a/desktop/lib/widgets/desktop_search_panel.dart b/desktop/lib/widgets/desktop_search_panel.dart
index b00c7db42..df3994332 100644
--- a/desktop/lib/widgets/desktop_search_panel.dart
+++ b/desktop/lib/widgets/desktop_search_panel.dart
@@ -8,6 +8,7 @@ import '../shortcuts/app_keymap.dart';
import '../shortcuts/keymap.dart';
import '../state/swarm_navigation.dart';
import '../state/swarm_search.dart';
+import '../state/workspace_chrome.dart';
import 'desktop_chrome.dart';
import 'finger_target.dart';
import 'box_chrome.dart' show ReadlineKeys;
@@ -15,6 +16,9 @@ import 'swarm_switcher.dart';
import 'swarm_search_input.dart';
import 'key_hints.dart';
import 'machine_picker_extras.dart';
+import 'swarm_resource_preview.dart' show resourcePreviewFormFocused;
+
+part 'desktop_search_pages.dart';
/// A desktop command palette over the existing search and activation pipeline.
/// Category buttons edit the same query as keyboard prefixes; no second index.
@@ -93,6 +97,23 @@ class DesktopSearchPanel extends StatelessWidget {
@override
Widget build(BuildContext context) {
+ // Only a host that can go compact (the web) pages its results; Desktop,
+ // which sets no compactBelow, builds the panel as it always has.
+ if (search.harnessContext != null ||
+ WorkspaceChrome.of(context).compactBelow <= 0) {
+ return _panel(context, null);
+ }
+ return _SearchPages(
+ search: search,
+ onChoose: onChoose,
+ onRefocus: onRefocus,
+ builder: _panel,
+ );
+ }
+
+ /// The panel; [pages] is non-null on a phone, where the results and a row's
+ /// details are two pages under the search field and its scopes.
+ Widget _panel(BuildContext context, _SearchPagesState? pages) {
grid.AppTheme.watch(context);
// A phone's buttons are a finger's size; a mouse keeps 32. On a phone the
// three glyphs share one size, and the row's right inset puts Close's glyph
@@ -100,6 +121,30 @@ class DesktopSearchPanel extends StatelessWidget {
final compact = workspaceIsCompact(context);
final button = compact ? kFingerTarget : 32.0;
final glyph = compact ? 20.0 : 18.0;
+ final hooks = _machineHooks(context);
+ Widget machineHeader(MachinePickerHooks hooks) => ListenableBuilder(
+ listenable: search,
+ builder: (context, _) => search.isMachineMode
+ ? MachinePickerHeader(search: search, hooks: hooks)
+ : const SizedBox.shrink(),
+ );
+ Widget machineFooter(MachinePickerHooks hooks) => ListenableBuilder(
+ listenable: search,
+ builder: (context, _) => search.isMachineMode
+ ? Column(
+ mainAxisSize: MainAxisSize.min,
+ crossAxisAlignment: CrossAxisAlignment.stretch,
+ children: [
+ Divider(height: 1, color: DesktopChrome.rim),
+ MachinePickerFooter(
+ search: search,
+ hooks: hooks,
+ onAddMachine: _addMachine,
+ ),
+ ],
+ )
+ : const SizedBox.shrink(),
+ );
return DesktopChrome(
child: Align(
alignment: Alignment.topCenter,
@@ -204,7 +249,9 @@ class DesktopSearchPanel extends StatelessWidget {
),
),
),
- if (search.harnessContext == null)
+ // A phone's preview is a page of its own: nothing to
+ // show or hide beside the list.
+ if (search.harnessContext == null && pages == null)
ListenableBuilder(
listenable: search,
builder: (context, _) => _toolbarButton(
@@ -275,49 +322,53 @@ class DesktopSearchPanel extends StatelessWidget {
),
),
),
- if (_machineHooks(context) case final hooks?)
- ListenableBuilder(
- listenable: search,
- builder: (context, _) => search.isMachineMode
- ? MachinePickerHeader(search: search, hooks: hooks)
- : const SizedBox.shrink(),
- ),
- Flexible(
- child: ListenableBuilder(
- listenable: search,
- builder: (context, _) => SwarmSearchResults(
- search: search,
- onChoose: onChoose,
- onRefocus: onRefocus,
- // Keep the dialog, editor, and footer stationary while a
- // query gains a preview or changes to an empty result.
- fitRows: search.harnessContext != null,
- // The scope control already explains the empty search.
- // Give results the full width until there is a preview.
- showPreview: !search.showsTypeHints,
- sideBySideMinWidth: 800,
- previewBuilder: previewBuilder,
- ),
- ),
- ),
- if (_machineHooks(context) case final hooks?)
- ListenableBuilder(
- listenable: search,
- builder: (context, _) => search.isMachineMode
- ? Column(
- mainAxisSize: MainAxisSize.min,
- crossAxisAlignment: CrossAxisAlignment.stretch,
- children: [
- Divider(height: 1, color: DesktopChrome.rim),
- MachinePickerFooter(
+ if (pages != null)
+ Flexible(
+ child: pages.view(
+ list: Column(
+ crossAxisAlignment: CrossAxisAlignment.stretch,
+ children: [
+ if (hooks != null) machineHeader(hooks),
+ Expanded(
+ child: ListenableBuilder(
+ listenable: search,
+ builder: (context, _) => SwarmSearchResults(
search: search,
- hooks: hooks,
- onAddMachine: _addMachine,
+ onChoose: pages.choose,
+ onRefocus: onRefocus,
+ showPreview: false,
+ onShowDetails: pages.show,
),
- ],
- )
- : const SizedBox.shrink(),
+ ),
+ ),
+ if (hooks != null) machineFooter(hooks),
+ ],
+ ),
+ preview: previewBuilder,
+ ),
+ )
+ else ...[
+ if (hooks != null) machineHeader(hooks),
+ Flexible(
+ child: ListenableBuilder(
+ listenable: search,
+ builder: (context, _) => SwarmSearchResults(
+ search: search,
+ onChoose: onChoose,
+ onRefocus: onRefocus,
+ // Keep the dialog, editor, and footer stationary while a
+ // query gains a preview or changes to an empty result.
+ fitRows: search.harnessContext != null,
+ // The scope control already explains the empty search.
+ // Give results the full width until there is a preview.
+ showPreview: !search.showsTypeHints,
+ sideBySideMinWidth: 800,
+ previewBuilder: previewBuilder,
+ ),
+ ),
),
+ if (hooks != null) machineFooter(hooks),
+ ],
if (search.harnessContext != null) ...[
Divider(height: 1, color: DesktopChrome.rim),
Padding(
diff --git a/desktop/lib/widgets/swarm_resource_preview.dart b/desktop/lib/widgets/swarm_resource_preview.dart
index 736d3cba9..f604c1eb4 100644
--- a/desktop/lib/widgets/swarm_resource_preview.dart
+++ b/desktop/lib/widgets/swarm_resource_preview.dart
@@ -59,6 +59,16 @@ const resourcePickerCommands = {
'picker.machine_cli',
};
+/// Whether the focused control is in a form the preview has open — Rename…,
+/// Share…, an API's — which takes Escape for itself before anything around it.
+bool resourcePreviewFormFocused() {
+ final context = FocusManager.instance.primaryFocus?.context;
+ return context != null &&
+ (context.findAncestorWidgetOfExactType<MachinePickerForm>() != null ||
+ context.findAncestorWidgetOfExactType<MachineSharingForm>() != null ||
+ context.findAncestorWidgetOfExactType<ApiPickerForm>() != null);
+}
+
/// Shortcuts act on the current result without moving focus out of search.
class SearchPreviewControls {
bool Function(String command)? dispatch;
diff --git a/desktop/lib/widgets/swarm_switcher.dart b/desktop/lib/widgets/swarm_switcher.dart
index 0b17ffa3e..e7fc41054 100644
--- a/desktop/lib/widgets/swarm_switcher.dart
+++ b/desktop/lib/widgets/swarm_switcher.dart
@@ -533,6 +533,36 @@ double swarmSearchResultsHeight(
(search.selected != null && !search.canAccept ? 48 : 0);
/// Shared harness search results, also used for commands and History.
+/// Whether choosing [row] only selects it, so that its preview's actions can be
+/// used: a machine or a signed-in phone or app in the Open Harness picker, and
+/// Add machine in any '@' scope. The one rule for the workspace's choose path
+/// and a phone's pages.
+///
+/// On a phone (the web below [WorkspaceChrome.compactBelow]) the search's list
+/// and a row's preview are two pages, as an iPhone app's list and its detail.
+/// What a tap on a row does there:
+/// - A row that only selects drills in to its preview.
+/// - Every other row keeps doing what its tap does: a harness opens, a project
+/// lists its harnesses, an agent or a model is used, a store entry or a
+/// command runs. When it has a preview, a chevron at its end drills in.
+bool swarmSearchRowSelectsOnly(
+ SwarmSearchController search,
+ SwarmDestination row,
+) =>
+ (search.setupLayout && (row.isMachine || row.isAccountDevice)) ||
+ (row.isCreate && search.isMachineMode);
+
+/// Whether [row], once selected, has a preview a phone can drill in to. Not
+/// whether one shows now: an empty search selects nothing until a row is
+/// chosen, and choosing one is what the chevron does.
+bool swarmSearchRowHasDetails(
+ SwarmSearchController search,
+ SwarmDestination row,
+) =>
+ search.supportsPreview &&
+ search.previewVisible &&
+ (!row.isCreate || swarmSearchRowSelectsOnly(search, row));
+
class SwarmSearchResults extends StatefulWidget {
const SwarmSearchResults({
super.key,
@@ -546,6 +576,7 @@ class SwarmSearchResults extends StatefulWidget {
this.header,
this.previewBuilder,
this.showPreview = true,
+ this.onShowDetails,
this.now = DateTime.now,
});
final SwarmSearchController search;
@@ -561,6 +592,12 @@ class SwarmSearchResults extends StatefulWidget {
final Widget? header;
final Widget Function()? previewBuilder;
final bool showPreview;
+
+ /// On a phone, where a row's preview is a page of its own: opens [row]'s
+ /// ([swarmSearchRowSelectsOnly]). Its rows end in a chevron, which on a row
+ /// that acts when tapped is the way to its details. Null — a wider window,
+ /// Desktop — draws the rows as they always were.
+ final ValueChanged<SwarmDestination>? onShowDetails;
final DateTime Function() now;
@override
State<SwarmSearchResults> createState() => _SwarmSearchResultsState();
@@ -891,6 +928,45 @@ class _SwarmSearchResultsState extends State<SwarmSearchResults> {
}
}
+ /// A phone row's way to its details. A row that drills in when tapped draws
+ /// the chevron only as a sign of it; any other row gets a finger-sized
+ /// button, so that its tap can keep doing what it does.
+ Widget _detailsChevron(
+ SwarmDestination row, {
+ required bool drills,
+ required bool highlighted,
+ }) {
+ final glyph = Icon(
+ AppIcons.chevronRight,
+ size: 18,
+ color: highlighted ? DesktopChrome.selectionDetail : DesktopChrome.muted,
+ );
+ if (drills) {
+ return ExcludeSemantics(
+ child: SizedBox(
+ width: kFingerTarget - 14,
+ child: Center(child: glyph),
+ ),
+ );
+ }
+ return IconButton(
+ key: ValueKey('swarm-row-details:${row.id}'),
+ tooltip: 'Details for ${row.title}',
+ constraints: const BoxConstraints.tightFor(
+ width: kFingerTarget,
+ height: kFingerTarget,
+ ),
+ padding: EdgeInsets.zero,
+ // The list's compact density would take 4 px off a finger's target.
+ visualDensity: VisualDensity.standard,
+ onPressed: () {
+ _focusResult(row.id);
+ widget.onShowDetails?.call(row);
+ },
+ icon: glyph,
+ );
+ }
+
@override
void dispose() {
_activityClock?.cancel();
@@ -1020,6 +1096,20 @@ class _SwarmSearchResultsState extends State<SwarmSearchResults> {
// Live display metadata is independent of the ranking snapshot.
final activity = _activity.read(row);
final activityAge = sessionActivityLabel(activity, widget.now());
+ // A phone's row ends in a chevron to its details, when it has any.
+ final details = widget.onShowDetails == null
+ ? null
+ : (
+ drills: swarmSearchRowSelectsOnly(search, row),
+ has: swarmSearchRowHasDetails(search, row),
+ );
+ // A row that acts when tapped has its details behind a button of
+ // its own, beside the tile: a dense tile's trailing slot is 40 px,
+ // short of a finger.
+ final detailsButton =
+ desktop && details != null && details.has && !details.drills
+ ? _detailsChevron(row, drills: false, highlighted: highlighted)
+ : null;
final presentation = (
row,
shortcut,
@@ -1055,6 +1145,7 @@ class _SwarmSearchResultsState extends State<SwarmSearchResults> {
search.wordsQuery,
)
: null,
+ details,
);
final previous = _rowWidgets.remove(row.id);
if (previous?.presentation == presentation) {
@@ -1253,7 +1344,17 @@ class _SwarmSearchResultsState extends State<SwarmSearchResults> {
activityAge: activityAge,
activity: activity,
),
- trailing: desktop
+ // On a phone the chevron takes the shortcut's place: keys
+ // are not advertised there.
+ trailing: details != null && details.has && details.drills
+ ? _detailsChevron(
+ row,
+ drills: true,
+ highlighted: highlighted,
+ )
+ : detailsButton != null
+ ? null
+ : desktop
? shortcut == null
? null
: ConstrainedBox(
@@ -1368,7 +1469,15 @@ class _SwarmSearchResultsState extends State<SwarmSearchResults> {
? grid.AppSurface.selectedFill
: Colors.transparent,
borderRadius: BorderRadius.circular(10),
- child: tile,
+ child: detailsButton == null
+ ? tile
+ : Row(
+ children: [
+ Expanded(child: tile),
+ detailsButton,
+ const SizedBox(width: 4),
+ ],
+ ),
),
)
: widget.bios
diff --git a/desktop/test/web_menus_test.dart b/desktop/test/web_menus_test.dart
index 49bf468ba..a639261de 100644
--- a/desktop/test/web_menus_test.dart
+++ b/desktop/test/web_menus_test.dart
@@ -403,13 +403,26 @@ void main() {
) async {
await machines(tester, _phone);
- for (final key in machineActions) {
- expect(
- _target(tester, key).height,
- greaterThanOrEqualTo(_finger),
- reason: '$key',
- );
+ // The list's own actions, then the machine's, on its details page.
+ void measure(Iterable<Key> keys) {
+ for (final key in keys) {
+ expect(
+ _target(tester, key).height,
+ greaterThanOrEqualTo(_finger),
+ reason: '$key',
+ );
+ }
}
+
+ measure(machineActions.skip(2));
+ final machine = tester
+ .widget<SwarmSearchResults>(find.byType(SwarmSearchResults))
+ .search
+ .selected!;
+ await tester.tap(find.byKey(ValueKey(machine.id)));
+ await tester.pump();
+ await tester.pump(const Duration(milliseconds: 400));
+ measure(machineActions.take(2));
expect(tester.takeException(), isNull);
await tester.pumpWidget(const SizedBox.shrink());
});
diff --git a/desktop/test/web_search_drill_down_test.dart b/desktop/test/web_search_drill_down_test.dart
new file mode 100644
index 000000000..dcb1658f5
--- /dev/null
+++ b/desktop/test/web_search_drill_down_test.dart
@@ -0,0 +1,533 @@
+// The search overlay on a phone (the web below compactBelow) is two pages, as
+// an iPhone app's list and its detail: the results alone, then one row's
+// preview behind a Back. Owner, 2026-10-27, on '@' Machines at 390 px: "split
+// it into slides instead of stacking two blocks". A wide window, and Desktop,
+// keep the list and the preview side by side or stacked as before.
+
+import 'package:flutter/material.dart';
+import 'package:flutter/services.dart';
+import 'package:flutter_test/flutter_test.dart';
+import 'package:harness/screens/swarm_screen.dart';
+import 'package:harness/shared/theme/app_theme.dart' as grid;
+import 'package:harness/state/swarm_search.dart';
+import 'package:harness/web/shell/web_chrome.dart';
+import 'package:harness/widgets/desktop_search_panel.dart';
+import 'package:harness/widgets/machine_picker_extras.dart';
+import 'package:harness/widgets/machine_picker_form.dart';
+import 'package:harness/widgets/swarm_switcher.dart';
+
+import '../tool/web_ux_seed.dart';
+import 'support/real_fonts.dart';
+import 'support/web_ux_app.dart';
+
+const _phone = Size(390, 844);
+const _input = ValueKey('swarm-search-input');
+const _back = ValueKey('search-details-back');
+const _title = ValueKey('search-details-title');
+const _actions = ValueKey('swarm-search-resource-actions');
+const _list = ValueKey('swarm-search-result-list');
+
+Future<WebUxApp> _openSearch(
+ WidgetTester tester,
+ Size size, {
+ bool web = true,
+ bool reduceMotion = false,
+ int extraMachines = 0,
+}) async {
+ final app = withPanes(signedIn(), 2);
+ for (var i = 0; i < extraMachines; i++) {
+ app.addMachine('x$i', 'Spare machine $i');
+ }
+ addTearDown(app.dispose);
+ tester.view.devicePixelRatio = 1;
+ tester.view.physicalSize = size;
+ addTearDown(tester.view.reset);
+ await tester.pumpWidget(
+ MaterialApp(
+ theme: grid.buildAppTheme(brightness: Brightness.dark),
+ builder: (context, child) => MediaQuery(
+ data: MediaQuery.of(context).copyWith(disableAnimations: reduceMotion),
+ child: child!,
+ ),
+ home: SwarmScreen(
+ notifier: app,
+ nativeTabs: false,
+ chrome: web ? webWorkspaceChrome(app) : null,
+ ),
+ ),
+ );
+ await tester.pump(const Duration(milliseconds: 200));
+ await tester.tap(find.byKey(const ValueKey('swarm-search-button')));
+ await tester.pump(const Duration(milliseconds: 300));
+ return app;
+}
+
+Future<void> _close(WidgetTester tester) async {
+ await tester.pumpWidget(const SizedBox.shrink());
+ await tester.pump(const Duration(seconds: 1));
+}
+
+SwarmSearchController _search(WidgetTester tester) => tester
+ .widget<SwarmSearchResults>(
+ find.byType(SwarmSearchResults, skipOffstage: false),
+ )
+ .search;
+
+Future<void> _type(WidgetTester tester, String text) async {
+ await tester.enterText(find.byKey(_input), text);
+ await tester.pump(const Duration(milliseconds: 300));
+}
+
+String _rowId(WidgetTester tester, String title) =>
+ _search(tester).rows.firstWhere((row) => row.title == title).id;
+
+/// Taps the row titled [title] and lets any slide finish.
+Future<void> _tapRow(WidgetTester tester, String title) async {
+ await tester.tap(find.byKey(ValueKey(_rowId(tester, title))));
+ await tester.pump();
+ await tester.pump(const Duration(milliseconds: 400));
+}
+
+bool _onDetails(WidgetTester tester) =>
+ find.byKey(_back).hitTestable().evaluate().isNotEmpty;
+
+bool _onList(WidgetTester tester) =>
+ find.byKey(_list).hitTestable().evaluate().isNotEmpty;
+
+void main() {
+ setUpAll(loadRealFonts);
+
+ testWidgets('a phone lists machines alone, with no preview under them', (
+ tester,
+ ) async {
+ await _openSearch(tester, _phone);
+ await _type(tester, '@');
+ expect(_search(tester).selected, isNotNull);
+ expect(_onList(tester), isTrue);
+ // The preview is built, so its commands still run, but not on this page.
+ expect(find.text('Rename').hitTestable(), findsNothing);
+ expect(find.byKey(_back), findsNothing);
+ // The list reaches down to the footer's actions, not to half the sheet.
+ final list = tester.getRect(find.byKey(_list));
+ final footer = tester.getRect(find.byType(MachinePickerFooter));
+ expect(footer.top - list.bottom, lessThan(16));
+ await _close(tester);
+ });
+
+ testWidgets('a phone hides the Preview toggle; 720 px keeps it', (
+ tester,
+ ) async {
+ await _openSearch(tester, _phone);
+ expect(find.byKey(const ValueKey('search-toggle-preview')), findsNothing);
+ for (final key in ['search-clear-query', 'search-close']) {
+ if (key == 'search-clear-query') await _type(tester, '@');
+ final size = tester.getSize(find.byKey(ValueKey(key)));
+ expect(size, const Size(44, 44), reason: key);
+ }
+ await _close(tester);
+
+ await _openSearch(tester, const Size(720, 900));
+ expect(find.byKey(const ValueKey('search-toggle-preview')), findsOneWidget);
+ await _close(tester);
+ });
+
+ testWidgets('a machine drills in to its details, and Back returns', (
+ tester,
+ ) async {
+ await _openSearch(tester, _phone);
+ await _type(tester, '@');
+ final machine = _rowId(tester, 'Studio Mac');
+ await _tapRow(tester, 'Studio Mac');
+ expect(_onDetails(tester), isTrue);
+ expect(_onList(tester), isFalse);
+ expect(tester.widget<Text>(find.byKey(_title)).data, 'Studio Mac');
+ expect(find.text('Rename').hitTestable(), findsOneWidget);
+ // A finger's Back, at the top left of the page.
+ final back = tester.getRect(find.byKey(_back));
+ expect(back.width, greaterThanOrEqualTo(44));
+ expect(back.height, greaterThanOrEqualTo(44));
+ final panel = tester.getRect(
+ find.byKey(const ValueKey('swarm-search-results')),
+ );
+ expect(back.left - panel.left, lessThan(24));
+
+ await tester.tap(find.byKey(_back));
+ await tester.pump();
+ await tester.pump(const Duration(milliseconds: 400));
+ expect(_onList(tester), isTrue);
+ expect(_onDetails(tester), isFalse);
+ expect(_search(tester).selected?.id, machine);
+ await _close(tester);
+ });
+
+ testWidgets('Back leaves the keyboard down; keys still reach the search', (
+ tester,
+ ) async {
+ await _openSearch(tester, _phone);
+ await _type(tester, '@');
+ await _tapRow(tester, 'Studio Mac');
+ await tester.tap(find.byKey(_back));
+ await tester.pump();
+ await tester.pump(const Duration(milliseconds: 400));
+ // A tap back to the list is not a request to type: on a phone a focused
+ // field raises the keyboard over the list just returned to.
+ final focused = FocusManager.instance.primaryFocus?.context;
+ expect(
+ focused?.findAncestorStateOfType<EditableTextState>(),
+ isNull,
+ reason: '$focused',
+ );
+ expect(
+ focused?.findAncestorWidgetOfExactType<SwarmSearchResults>(),
+ isNull,
+ );
+ await tester.sendKeyEvent(LogicalKeyboardKey.escape);
+ await tester.pump(const Duration(milliseconds: 300));
+ expect(find.byType(SwarmSearchResults), findsNothing);
+ await _close(tester);
+ });
+
+ testWidgets('Back keeps the list where it was scrolled', (tester) async {
+ await _openSearch(tester, _phone, extraMachines: 24);
+ await _type(tester, '@');
+ ScrollPosition position() => tester
+ .state<ScrollableState>(
+ find.descendant(
+ of: find.byKey(_list),
+ matching: find.byType(Scrollable),
+ ),
+ )
+ .position;
+ await tester.drag(find.byKey(_list), const Offset(0, -500));
+ await tester.pump(const Duration(milliseconds: 400));
+ final scrolled = position().pixels;
+ expect(scrolled, greaterThan(100));
+ await _tapRow(tester, 'Spare machine 12');
+ expect(_onDetails(tester), isTrue);
+ final chosen = _search(tester).selected!.id;
+ await tester.tap(find.byKey(_back));
+ await tester.pump();
+ await tester.pump(const Duration(milliseconds: 400));
+ expect(_onList(tester), isTrue);
+ expect(_search(tester).selected?.id, chosen);
+ expect(position().pixels, closeTo(scrolled, 1));
+ await _close(tester);
+ });
+
+ testWidgets('Escape returns to the list and keeps the search open', (
+ tester,
+ ) async {
+ await _openSearch(tester, _phone);
+ await _type(tester, '@');
+ final machine = _rowId(tester, 'Studio Mac');
+ await _tapRow(tester, 'Studio Mac');
+ expect(_onDetails(tester), isTrue);
+ await tester.sendKeyEvent(LogicalKeyboardKey.escape);
+ await tester.pump();
+ await tester.pump(const Duration(milliseconds: 400));
+ expect(find.byType(SwarmSearchResults), findsOneWidget);
+ expect(_onList(tester), isTrue);
+ expect(_search(tester).selected?.id, machine);
+ await _close(tester);
+ });
+
+ testWidgets('Escape in a details page\'s form closes the form first', (
+ tester,
+ ) async {
+ await _openSearch(tester, _phone);
+ await _type(tester, '@');
+ await _tapRow(tester, 'Studio Mac');
+ await tester.tap(find.text('Rename'));
+ await tester.pump(const Duration(milliseconds: 300));
+ final field = find.descendant(
+ of: find.byType(MachinePickerForm),
+ matching: find.byType(EditableText),
+ );
+ expect(field, findsOneWidget);
+ await tester.sendKeyEvent(LogicalKeyboardKey.escape);
+ await tester.pump(const Duration(milliseconds: 300));
+ expect(find.byType(MachinePickerForm), findsNothing);
+ expect(_onDetails(tester), isTrue);
+ expect(find.byType(SwarmSearchResults, skipOffstage: false), findsOne);
+ await _close(tester);
+ });
+
+ testWidgets('a right swipe from the edge returns to the list', (
+ tester,
+ ) async {
+ await _openSearch(tester, _phone);
+ await _type(tester, '@');
+ await _tapRow(tester, 'Studio Mac');
+ expect(_onDetails(tester), isTrue);
+ final panel = tester.getRect(
+ find.byKey(const ValueKey('swarm-search-results')),
+ );
+ final page = tester.getRect(find.byKey(_actions));
+ await tester.dragFrom(
+ Offset(panel.left + 6, page.top - 40),
+ const Offset(220, 0),
+ );
+ await tester.pump();
+ await tester.pump(const Duration(milliseconds: 400));
+ expect(_onList(tester), isTrue);
+ await _close(tester);
+ });
+
+ testWidgets('Return on a selected machine drills in on a phone', (
+ tester,
+ ) async {
+ await _openSearch(tester, _phone);
+ await _type(tester, '@');
+ final index = _search(tester).rows
+ .indexWhere((row) => row.title == 'Studio Mac');
+ _search(tester).move(index - _search(tester).cursor);
+ await tester.pump();
+ await tester.sendKeyEvent(LogicalKeyboardKey.enter);
+ await tester.pump();
+ await tester.pump(const Duration(milliseconds: 400));
+ expect(_onDetails(tester), isTrue);
+ await _close(tester);
+ });
+
+ testWidgets('typing on the details page returns to the list', (tester) async {
+ await _openSearch(tester, _phone);
+ await _type(tester, '@');
+ await _tapRow(tester, 'Studio Mac');
+ expect(_onDetails(tester), isTrue);
+ await _type(tester, '@ stu');
+ expect(_onList(tester), isTrue);
+ expect(_onDetails(tester), isFalse);
+ // A scope chip changes the query too.
+ await _tapRow(tester, 'Studio Mac');
+ expect(_onDetails(tester), isTrue);
+ await tester.tap(find.byKey(const ValueKey('search-category-Harnesses')));
+ await tester.pump(const Duration(milliseconds: 400));
+ expect(_onDetails(tester), isFalse);
+ await _close(tester);
+ });
+
+ testWidgets('a harness still opens at once; its chevron drills in', (
+ tester,
+ ) async {
+ final app = await _openSearch(tester, _phone);
+ final id = _rowId(tester, 'Docs pass');
+ final chevron = tester.getSize(
+ find.byKey(
+ ValueKey('swarm-row-details:${_rowId(tester, 'Release notes')}'),
+ ),
+ );
+ expect(chevron.width, greaterThanOrEqualTo(44));
+ expect(chevron.height, greaterThanOrEqualTo(44));
+ await tester.tap(find.byKey(ValueKey('swarm-row-details:$id')));
+ await tester.pump();
+ await tester.pump(const Duration(milliseconds: 400));
+ expect(_onDetails(tester), isTrue);
+ expect(_search(tester).selected?.id, id);
+ expect(tester.widget<Text>(find.byKey(_title)).data, 'Docs pass');
+ await tester.tap(find.byKey(_back));
+ await tester.pump(const Duration(milliseconds: 400));
+
+ await _tapRow(tester, 'Docs pass');
+ expect(find.byType(SwarmSearchResults), findsNothing);
+ expect(app.activeSwarm.panes.any((pane) => pane.agentId == 'a3'), isTrue);
+ await _close(tester);
+ });
+
+ testWidgets('Reduce Motion shows the details page without a slide', (
+ tester,
+ ) async {
+ Future<double> backLeftAfterOneFrame({required bool reduceMotion}) async {
+ await _openSearch(tester, _phone, reduceMotion: reduceMotion);
+ await _type(tester, '@');
+ await tester.tap(find.byKey(ValueKey(_rowId(tester, 'Studio Mac'))));
+ await tester.pump();
+ await tester.pump(const Duration(milliseconds: 60));
+ final left = tester.getRect(find.byKey(_back)).left;
+ await tester.pump(const Duration(milliseconds: 400));
+ final settled = tester.getRect(find.byKey(_back)).left;
+ await _close(tester);
+ return left - settled;
+ }
+
+ expect(await backLeftAfterOneFrame(reduceMotion: false), greaterThan(20));
+ expect(await backLeftAfterOneFrame(reduceMotion: true), 0);
+ });
+
+ testWidgets('widening the window shows the list and preview together', (
+ tester,
+ ) async {
+ await _openSearch(tester, _phone);
+ await _type(tester, '@');
+ final machine = _rowId(tester, 'Studio Mac');
+ await _tapRow(tester, 'Studio Mac');
+ expect(_onDetails(tester), isTrue);
+ tester.view.physicalSize = const Size(1280, 800);
+ await tester.pump();
+ await tester.pump(const Duration(milliseconds: 400));
+ expect(find.byKey(_back), findsNothing);
+ expect(_onList(tester), isTrue);
+ expect(find.text('Rename').hitTestable(), findsOneWidget);
+ expect(_search(tester).selected?.id, machine);
+ expect(find.byKey(_input), findsOneWidget);
+ await _close(tester);
+ });
+
+ testWidgets('every row whose tap only selects it drills in on a phone', (
+ tester,
+ ) async {
+ await _openSearch(tester, _phone);
+ await _type(tester, '@');
+ final titles = [
+ for (final row in _search(tester).rows)
+ if (row.isMachine || row.isAccountDevice || row.isCreate) row.title,
+ ];
+ expect(titles, containsAll(['Studio Mac', 'Add machine']));
+ for (final title in titles) {
+ await _tapRow(tester, title);
+ expect(_onDetails(tester), isTrue, reason: title);
+ expect(tester.widget<Text>(find.byKey(_title)).data, title);
+ await tester.tap(find.byKey(_back));
+ await tester.pump();
+ await tester.pump(const Duration(milliseconds: 400));
+ }
+ await _close(tester);
+ });
+
+ test('Add machine drills in wherever its tap only selects it', () {
+ // A picker that is not the main Open Harness one (a pane's split) still
+ // only selects Add machine when it is tapped in the '@' scope: a phone
+ // must show its page, or the tap does nothing visible.
+ final app = withPanes(signedIn(), 1);
+ addTearDown(app.dispose);
+ final search = SwarmSearchController(
+ app,
+ const [],
+ adding: true,
+ offersCreate: true,
+ );
+ addTearDown(search.dispose);
+ search.setQuery('@');
+ final add = search.rows.firstWhere((row) => row.isCreate);
+ expect(search.setupLayout, isFalse);
+ expect(swarmSearchRowSelectsOnly(search, add), isTrue);
+ });
+
+ testWidgets('a preview hidden on a wide window is shown on a phone', (
+ tester,
+ ) async {
+ await _openSearch(tester, const Size(1280, 800));
+ await tester.tap(find.byKey(const ValueKey('search-toggle-preview')));
+ await tester.pump(const Duration(milliseconds: 300));
+ expect(_search(tester).previewVisible, isFalse);
+ tester.view.physicalSize = _phone;
+ await tester.pump();
+ await tester.pump(const Duration(milliseconds: 300));
+ // Harness rows keep their way to their details…
+ final id = _rowId(tester, 'Docs pass');
+ expect(find.byKey(ValueKey('swarm-row-details:$id')), findsOneWidget);
+ // …and a machine's page is never blank.
+ await _type(tester, '@');
+ await _tapRow(tester, 'Studio Mac');
+ expect(_onDetails(tester), isTrue);
+ expect(find.text('Rename').hitTestable(), findsOneWidget);
+ await _close(tester);
+ });
+
+ testWidgets('a row picked by its number drills in like a tap', (
+ tester,
+ ) async {
+ await _openSearch(tester, _phone);
+ await _type(tester, '@');
+ final index = _search(tester).rows
+ .indexWhere((row) => row.title == 'Studio Mac');
+ final digit = [
+ LogicalKeyboardKey.digit1,
+ LogicalKeyboardKey.digit2,
+ LogicalKeyboardKey.digit3,
+ ][index];
+ await tester.sendKeyDownEvent(LogicalKeyboardKey.altLeft);
+ await tester.sendKeyEvent(digit);
+ await tester.sendKeyUpEvent(LogicalKeyboardKey.altLeft);
+ await tester.pump();
+ await tester.pump(const Duration(milliseconds: 400));
+ expect(_onDetails(tester), isTrue);
+ expect(tester.widget<Text>(find.byKey(_title)).data, 'Studio Mac');
+ await _close(tester);
+ });
+
+ testWidgets('a chevron names the row it opens', (tester) async {
+ final semantics = tester.ensureSemantics();
+ await _openSearch(tester, _phone);
+ final id = _rowId(tester, 'Docs pass');
+ expect(
+ tester.getSemantics(find.byKey(ValueKey('swarm-row-details:$id'))),
+ isSemantics(tooltip: 'Details for Docs pass'),
+ );
+ await _close(tester);
+ semantics.dispose();
+ });
+
+ testWidgets('every control on both pages takes a finger', (tester) async {
+ await _openSearch(tester, _phone);
+ await _type(tester, '@');
+ await _tapRow(tester, 'Studio Mac');
+ final buttons = find.byWidgetPredicate(
+ (widget) => widget is ButtonStyleButton || widget is IconButton,
+ );
+ for (final element in buttons.hitTestable().evaluate()) {
+ final box = element.renderObject! as RenderBox;
+ expect(box.size.width, greaterThanOrEqualTo(44), reason: '$element');
+ expect(box.size.height, greaterThanOrEqualTo(44), reason: '$element');
+ }
+ await _close(tester);
+ });
+
+ testWidgets('a wide window\'s search reads to a screen reader as before', (
+ tester,
+ ) async {
+ final semantics = tester.ensureSemantics();
+ await _openSearch(tester, const Size(1280, 800));
+ // The pager's own focus is for keys only: wrapping the panel must not
+ // make the dialog around it a focusable node of its own.
+ expect(
+ tester.getSemantics(find.byType(DesktopSearchPanel)),
+ isNot(isSemantics(isFocusable: true)),
+ );
+ await _close(tester);
+ semantics.dispose();
+ });
+
+ for (final (name, size, web) in [
+ ('720 px', const Size(720, 900), true),
+ ('a wide window', const Size(1280, 800), true),
+ ('Desktop at a phone\'s width', _phone, false),
+ ]) {
+ testWidgets('$name keeps the list and preview together, and its keys', (
+ tester,
+ ) async {
+ await _openSearch(tester, size, web: web);
+ await _type(tester, '@');
+ // Both on screen at once, with no page to go to.
+ expect(_onList(tester), isTrue);
+ expect(find.text('Rename').hitTestable(), findsOneWidget);
+ await _tapRow(tester, 'Studio Mac');
+ expect(find.byKey(_back), findsNothing);
+ expect(_onList(tester), isTrue);
+ // Return on a machine moves to its actions; Escape steps back to the
+ // field, then closes the search — as before.
+ await tester.sendKeyEvent(LogicalKeyboardKey.escape);
+ await tester.pump(const Duration(milliseconds: 100));
+ expect(find.byType(SwarmSearchResults), findsOneWidget);
+ await tester.sendKeyEvent(LogicalKeyboardKey.enter);
+ await tester.pump(const Duration(milliseconds: 100));
+ expect(find.byType(SwarmSearchResults), findsOneWidget);
+ expect(_onList(tester), isTrue);
+ await tester.sendKeyEvent(LogicalKeyboardKey.escape);
+ await tester.pump(const Duration(milliseconds: 100));
+ await tester.sendKeyEvent(LogicalKeyboardKey.escape);
+ await tester.pump(const Duration(milliseconds: 300));
+ expect(find.byType(SwarmSearchResults), findsNothing);
+ await _close(tester);
+ });
+ }
+}
diff --git a/desktop/test/web_search_phone_test.dart b/desktop/test/web_search_phone_test.dart
index 29265be96..c2a76b308 100644
--- a/desktop/test/web_search_phone_test.dart
+++ b/desktop/test/web_search_phone_test.dart
@@ -1,6 +1,8 @@
-// The search overlay on a phone (the web below compactBelow): its Close and
-// preview buttons, its scope chips and its command rows are a finger's size
-// (audit finding S1). A wide window keeps the mouse's 32 px.
+// The search overlay on a phone (the web below compactBelow): its Clear and
+// Close buttons, its scope chips and its command rows are a finger's size
+// (audit finding S1). A wide window keeps the mouse's 32 px. A phone has no
+// Preview toggle: its preview is a page of its own
+// (web_search_drill_down_test.dart).
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
@@ -39,19 +41,19 @@ Future<void> _close(WidgetTester tester) async {
await tester.pump(const Duration(seconds: 1));
}
-const _controls = [
+const _phoneControls = [
'search-close',
- 'search-toggle-preview',
'search-category-Harnesses',
'search-category-Commands',
];
+const _controls = [..._phoneControls, 'search-toggle-preview'];
void main() {
setUpAll(loadRealFonts);
testWidgets('a phone\'s search is pressed with a finger', (tester) async {
await _openSearch(tester, const Size(390, 844));
- for (final key in _controls) {
+ for (final key in _phoneControls) {
final size = tester.getSize(find.byKey(ValueKey(key)));
expect(size.width, greaterThanOrEqualTo(44), reason: key);
expect(size.height, greaterThanOrEqualTo(44), reason: key);
@@ -88,11 +90,7 @@ void main() {
(w) => w is Icon || w is AppPaneIcon,
);
final sizes = {
- for (final key in [
- 'search-clear-query',
- 'search-toggle-preview',
- 'search-close',
- ])
+ for (final key in ['search-clear-query', 'search-close'])
glyphOf(key).width,
};
expect(sizes, {20.0});
diff --git a/desktop/tool/web_ux/checks.mjs b/desktop/tool/web_ux/checks.mjs
index e2e4db22c..234f65175 100644
--- a/desktop/tool/web_ux/checks.mjs
+++ b/desktop/tool/web_ux/checks.mjs
@@ -35,6 +35,9 @@ const TAP_FLOWS = FIXTURE !== 'app' ? FLOWS.map((f) => f.name) : [
'taken-over', 'view-only',
'shared-link', 'shared-link-private', 'shared-link-refused', 'shared-link-offline',
'shared-link-failed', 'settings-account',
+ // The phone search's list and details pages (flows/search.mjs).
+ 'search-machines', 'search-machine-details', 'search-machines-back', 'search-harnesses',
+ 'search-harness-details',
];
// Scrolling areas: the flow that shows one, and where it is.
diff --git a/desktop/tool/web_ux/flows/search.mjs b/desktop/tool/web_ux/flows/search.mjs
new file mode 100644
index 000000000..ae04fb138
--- /dev/null
+++ b/desktop/tool/web_ux/flows/search.mjs
@@ -0,0 +1,27 @@
+// Flows for the search on a phone: the results alone, a row's details behind a Back, and the
+// list again (owner, 2026-10-27: "split it into slides instead of stacking two blocks").
+// A wider window shows the same flows with the list and preview together, as before.
+//
+// Fix group: phone search drill-down. Each group keeps its flows here, so parallel groups never
+// edit the same file; load-flows.mjs reads every file in this folder.
+import { menu } from './steps.mjs';
+
+const machines = menu('Machines');
+
+export const FLOWS = [
+ { name: 'search-machines', scenario: 'workspace', steps: machines },
+ { name: 'search-machine-details', scenario: 'workspace', steps: [...machines, ['text', 'Studio Mac']] },
+ {
+ name: 'search-machines-back',
+ scenario: 'workspace',
+ only: 'compact',
+ steps: [...machines, ['text', 'Studio Mac'], ['exact', 'Back']],
+ },
+ { name: 'search-harnesses', scenario: 'workspace', steps: [...machines, ['click', 'Harnesses']] },
+ {
+ name: 'search-harness-details',
+ scenario: 'workspace',
+ only: 'compact',
+ steps: [...machines, ['click', 'Harnesses'], ['click', 'Details']],
+ },
+];