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 {...@@ -21,7 +21,8 @@ extension CanvasView {
21 /// screenshot command; `snap:a` only logs, for a simulator screenshot with the keyboard;21 /// screenshot command; `snap:a` only logs, for a simulator screenshot with the keyboard;
22 /// `activate:Label` activates the element of any window so named, as VoiceOver would,22 /// `activate:Label` activates the element of any window so named, as VoiceOver would,
23 /// opening a button's menu or picking a menu's item or a list's row (`Row/Button` for a23 /// 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.
25 func runScript() {26 func runScript() {
26 // Only the first page shown runs it, not every page opened afterwards.27 // Only the first page shown runs it, not every page opened afterwards.
27 guard !scriptedPage, let script = ProcessInfo.processInfo.environment["SNOWBOUND_SCRIPT"] else { return }28 guard !scriptedPage, let script = ProcessInfo.processInfo.environment["SNOWBOUND_SCRIPT"] else { return }
...@@ -103,6 +104,13 @@ extension CanvasView {...@@ -103,6 +104,13 @@ extension CanvasView {
103 let caret = caretRect(for: range.start)104 let caret = caretRect(for: range.start)
104 menu.presentEditMenu(with: UIEditMenuConfiguration(identifier: nil, sourcePoint: CGPoint(x: caret.midX, y: caret.minY)))105 menu.presentEditMenu(with: UIEditMenuConfiguration(identifier: nil, sourcePoint: CGPoint(x: caret.midX, y: caret.minY)))
105 case "done": _ = resignFirstResponder()106 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)
106 case "wait", "snap": break114 case "wait", "snap": break
107 case "activate":115 case "activate":
108 // An alert's button, which takes no accessibility activation outside VoiceOver.116 // An alert's button, which takes no accessibility activation outside VoiceOver.
...@@ -144,6 +152,11 @@ extension CanvasView {...@@ -144,6 +152,11 @@ extension CanvasView {
144 list.selectItem(at: index, animated: false, scrollPosition: [])152 list.selectItem(at: index, animated: false, scrollPosition: [])
145 list.delegate?.collectionView?(list, didSelectItemAt: index)153 list.delegate?.collectionView?(list, didSelectItemAt: index)
146 }154 }
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)
147 } else if !found.accessibilityActivate(), let control = found as? UIControl {160 } else if !found.accessibilityActivate(), let control = found as? UIControl {
148 control.sendActions(for: .primaryActionTriggered)161 control.sendActions(for: .primaryActionTriggered)
149 }162 }