authoravatarclover caruso<git@paperclover.net>2026-10-19 16:24:37-07:00
committeravatarclover caruso<git@paperclover.net>2026-10-19 22:58:56-07:00
log198f258a1201fb5ea3088b6a4257fb2436e34368
tree1b16d00cf5a6b0f59601bc418208975272f7c547
parent4dba5df3e540c8f1091f6b99dc53c997dea40f7a
signature Signed by SSH key SHA256:52mNGHRsVFBDED9IAX5pe+LRWUefqTbxEReunq21QvU

test(ios): go back and pick table rows from SNOWBOUND_SCRIPT

`back` pops the innermost navigation stack shown, as a compact window's Back button does, and activate: picks a table's row. Assisted-by: claude-opus-5.5

1 files changed, 14 insertions(+), 1 deletions(-)

apps/ios/Snowbound/Script.swift+14-1
......@@ -21,7 +21,8 @@ extension CanvasView {
2121 /// screenshot command; `snap:a` only logs, for a simulator screenshot with the keyboard;
2222 /// `activate:Label` activates the element of any window so named, as VoiceOver would,
2323 /// opening a button's menu or picking a menu's item or a list's row (`Row/Button` for a
24 /// button in a row), and `audit` logs whether the format bar and tag grid name every button.
24 /// button in a row), `back` goes back, and `audit` logs whether the format bar and tag grid
25 /// name every button.
2526 func runScript() {
2627 // Only the first page shown runs it, not every page opened afterwards.
2728 guard !scriptedPage, let script = ProcessInfo.processInfo.environment["SNOWBOUND_SCRIPT"] else { return }
......@@ -103,6 +104,13 @@ extension CanvasView {
103104 let caret = caretRect(for: range.start)
104105 menu.presentEditMenu(with: UIEditMenuConfiguration(identifier: nil, sourcePoint: CGPoint(x: caret.midX, y: caret.minY)))
105106 case "done": _ = resignFirstResponder()
107 case "back":
108 // The innermost navigation stack shown, as its Back button pops it.
109 func stacks(_ controller: UIViewController) -> [UINavigationController] {
110 controller.children.flatMap(stacks) + [controller as? UINavigationController].compactMap { $0 }
111 }
112 let shown = Self.windows.compactMap(\.rootViewController).flatMap(stacks)
113 shown.first { $0.viewControllers.count > 1 && $0.viewIfLoaded?.window != nil }?.popViewController(animated: true)
106114 case "wait", "snap": break
107115 case "activate":
108116 // An alert's button, which takes no accessibility activation outside VoiceOver.
......@@ -144,6 +152,11 @@ extension CanvasView {
144152 list.selectItem(at: index, animated: false, scrollPosition: [])
145153 list.delegate?.collectionView?(list, didSelectItemAt: index)
146154 }
155 } else if let cell = found as? UITableViewCell, let table = chain.lazy.compactMap({ $0 as? UITableView }).first,
156 let index = table.indexPath(for: cell)
157 {
158 table.selectRow(at: index, animated: false, scrollPosition: .none)
159 table.delegate?.tableView?(table, didSelectRowAt: index)
147160 } else if !found.accessibilityActivate(), let control = found as? UIControl {
148161 control.sendActions(for: .primaryActionTriggered)
149162 }