Skip to content

Commit 7611802

Browse files
thymikeeopencode
andcommitted
fix(ios): read scroll indicator ownership from the parent edge (#2754 step 1)
An interactive snapshot of a list whose row hosts a scroll view of its own dropped every row after that host. A scroll indicator is published inside its own scroll view, but presentation found the owner by walking up past the indicator's parent to the nearest scrollable or text ancestor. A UITextView is a UIScrollView that publishes as `TextView`; #2740 stopped the walk at that one type, but any other scroll-shaped host that publishes as a non-scroll type — a `WebView`, a map view, a paged cell — still had its indicator attributed to the enclosing list, which then derived its visible band from the host's one-line track and clipped everything below it out of the interactive snapshot. The owner of an indicator is now read from the parent edge: a band derives only when the indicator's parent is itself a scroll type, and an indicator whose parent is not a scroll type owns nothing. This retires the ancestor walk and the `isTextViewType` special case (ADR 0026), and deliberately drops the self-ownership branch that no captured tree exercised. Tests: `runner-presentation.test.ts` gains red-on-main cases for a `WebView` row and a paged `Cell` row; the `TextView` case pins #2740's behavior as subsumed by the general rule. `assertProjectionSubsets` gains a `stage: 'presented'` arm so the runner stage is covered by the interactive-subset property, and a new `swift: false` interactive golden case in the engine conformance fixture captures the WebView ownership output. Co-authored-by: opencode <[email protected]>
1 parent a374bd9 commit 7611802

5 files changed

Lines changed: 429 additions & 23 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@
22

33
## Unreleased
44

5+
- Fixed (ios): an interactive snapshot no longer drops the rows of a list whose row hosts a scroll
6+
view of its own. Ownership of a scroll indicator is now read from its parent edge — a visible band
7+
derives only when the indicator's parent is itself a scroll type — instead of walking ancestors for
8+
the nearest scrollable or text node. #2740 closed the class for `TextView` alone; the walk still
9+
misattributed the indicator of any other scroll-shaped host that publishes as a non-scroll type (a
10+
`WebView`, a map view, a paged cell) to the enclosing list and clipped that list to the host's
11+
one-line band. The tradeoff ADR 0026 accepts: a scroll host whose own indicator sits under a
12+
labelled wrapper rather than directly under the scroll view now keeps its full extent (under-clip),
13+
rather than the old walk risking a mis-attribution onto an unrelated ancestor.
514
- Fixed (ios): `fold half-open` no longer reports a pose the hinge never held. The command accepted
615
the requested category as the answer whenever its four-read budget happened to end on a
716
`half-open` angle, so a hinge still sweeping from 180° toward 0° — which passes through every

‎contracts/fixtures/ios-snapshot-engine-conformance.json‎

Lines changed: 167 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1165,6 +1165,173 @@
11651165
}
11661166
]
11671167
}
1168+
},
1169+
{
1170+
"name": "scroll indicator owned by a parent web view keeps list rows",
1171+
"swift": false,
1172+
"projection": "regular",
1173+
"interactiveOnly": true,
1174+
"depth": null,
1175+
"scope": null,
1176+
"foldPolicy": "cursor-projected",
1177+
"truncated": false,
1178+
"residue": [],
1179+
"nodes": [
1180+
{
1181+
"index": 0,
1182+
"type": "Application",
1183+
"label": "App",
1184+
"rect": { "x": 0, "y": 0, "width": 320, "height": 240 },
1185+
"enabled": true,
1186+
"hittable": false,
1187+
"depth": 0
1188+
},
1189+
{
1190+
"index": 1,
1191+
"type": "Table",
1192+
"label": "Feed",
1193+
"rect": { "x": 0, "y": 40, "width": 320, "height": 200 },
1194+
"enabled": true,
1195+
"hittable": false,
1196+
"depth": 1,
1197+
"parentIndex": 0
1198+
},
1199+
{
1200+
"index": 2,
1201+
"type": "Other",
1202+
"label": "Story",
1203+
"rect": { "x": 16, "y": 60, "width": 288, "height": 22 },
1204+
"enabled": true,
1205+
"hittable": false,
1206+
"depth": 2,
1207+
"parentIndex": 1
1208+
},
1209+
{
1210+
"index": 3,
1211+
"type": "WebView",
1212+
"label": "Story",
1213+
"rect": { "x": 16, "y": 60, "width": 288, "height": 22 },
1214+
"enabled": true,
1215+
"hittable": false,
1216+
"depth": 3,
1217+
"parentIndex": 2
1218+
},
1219+
{
1220+
"index": 4,
1221+
"type": "Other",
1222+
"label": "Vertical scroll bar, 1 page",
1223+
"value": "0%",
1224+
"rect": { "x": 300, "y": 60, "width": 10, "height": 22 },
1225+
"enabled": true,
1226+
"hittable": false,
1227+
"depth": 4,
1228+
"parentIndex": 3
1229+
},
1230+
{
1231+
"index": 5,
1232+
"type": "Button",
1233+
"label": "Reply",
1234+
"rect": { "x": 16, "y": 100, "width": 60, "height": 28 },
1235+
"enabled": true,
1236+
"hittable": true,
1237+
"depth": 2,
1238+
"parentIndex": 1
1239+
},
1240+
{
1241+
"index": 6,
1242+
"type": "Button",
1243+
"label": "Like",
1244+
"rect": { "x": 16, "y": 140, "width": 60, "height": 28 },
1245+
"enabled": true,
1246+
"hittable": true,
1247+
"depth": 2,
1248+
"parentIndex": 1
1249+
},
1250+
{
1251+
"index": 7,
1252+
"type": "Other",
1253+
"label": "Vertical scroll bar, 3 pages",
1254+
"value": "0%",
1255+
"rect": { "x": 306, "y": 40, "width": 10, "height": 150 },
1256+
"enabled": true,
1257+
"hittable": false,
1258+
"depth": 2,
1259+
"parentIndex": 1
1260+
}
1261+
],
1262+
"expected": {
1263+
"outcome": "success",
1264+
"truncated": false,
1265+
"residue": [],
1266+
"nodes": [
1267+
{
1268+
"index": 0,
1269+
"type": "Application",
1270+
"label": "App",
1271+
"rect": { "x": 0, "y": 0, "width": 320, "height": 240 },
1272+
"depth": 0,
1273+
"parentIndex": null,
1274+
"hittable": false,
1275+
"hiddenContentAbove": false,
1276+
"hiddenContentBelow": false
1277+
},
1278+
{
1279+
"index": 1,
1280+
"type": "Table",
1281+
"label": "Feed",
1282+
"rect": { "x": 0, "y": 40, "width": 320, "height": 150 },
1283+
"depth": 1,
1284+
"parentIndex": 0,
1285+
"hittable": false,
1286+
"hiddenContentAbove": false,
1287+
"hiddenContentBelow": true
1288+
},
1289+
{
1290+
"index": 2,
1291+
"type": "Other",
1292+
"label": "Story",
1293+
"rect": { "x": 16, "y": 60, "width": 288, "height": 22 },
1294+
"depth": 2,
1295+
"parentIndex": 1,
1296+
"hittable": false,
1297+
"hiddenContentAbove": false,
1298+
"hiddenContentBelow": false
1299+
},
1300+
{
1301+
"index": 3,
1302+
"type": "WebView",
1303+
"label": "Story",
1304+
"rect": { "x": 16, "y": 60, "width": 288, "height": 22 },
1305+
"depth": 3,
1306+
"parentIndex": 2,
1307+
"hittable": false,
1308+
"hiddenContentAbove": false,
1309+
"hiddenContentBelow": false
1310+
},
1311+
{
1312+
"index": 4,
1313+
"type": "Button",
1314+
"label": "Reply",
1315+
"rect": { "x": 16, "y": 100, "width": 60, "height": 28 },
1316+
"depth": 2,
1317+
"parentIndex": 1,
1318+
"hittable": true,
1319+
"hiddenContentAbove": false,
1320+
"hiddenContentBelow": false
1321+
},
1322+
{
1323+
"index": 5,
1324+
"type": "Button",
1325+
"label": "Like",
1326+
"rect": { "x": 16, "y": 140, "width": 60, "height": 28 },
1327+
"depth": 2,
1328+
"parentIndex": 1,
1329+
"hittable": true,
1330+
"hiddenContentAbove": false,
1331+
"hiddenContentBelow": false
1332+
}
1333+
]
1334+
}
11681335
}
11691336
]
11701337
}

‎docs/adr/0026-scroll-clip-authority.md‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ walking up past the indicator's parent, and that guess decided which nodes exist
1616

1717
| Situation | Behavior |
1818
| --- | --- |
19-
| Which scroll view an indicator reports on | Its **parent**, when that parent is a scroll type (or the scroll host itself when it carries the label — open, below). UIKit publishes an indicator inside its own scroll view, and the producer's tree already says so |
19+
| Which scroll view an indicator reports on | Its **parent**, when that parent is a scroll type. UIKit publishes an indicator inside its own scroll view, and the producer's tree already says so. A node that is **itself** a scroll type and carries the label describes itself, not its parent, so it owns nothing (resolved: #2754 step 1 — banding its parent would clip a sibling list to the host's band, mirroring #2214 upward) |
2020
| An indicator whose parent is not a scroll type — `TextView`, `WebView`, a cell | Owns nothing. No band, no clip, and the host's own scrollability stays with that host |
2121
| The visible band | Derived by presentation from the owner's frame and the indicator's track. Never reported by a producer |
2222
| Removing a node **because a scroll band hides it** | Requires evidence: the clip fold's result, or a band whose owner is the indicator's parent. A guess about ownership may not do it |
@@ -100,9 +100,13 @@ source of truth.
100100
keeps rows that `main` drops. Real captured trees must be surveyed for that wrapper shape before landing.
101101
- **The `WebView` instance is synthetic.** The mechanism is confirmed in a hand-built tree; that XCTest
102102
publishes a `WKWebView`'s indicator the same way is unverified.
103-
- **The self case is unpinned.** The rule also treats a scroll-typed node carrying an indicator label as
104-
its own owner. No test exercises that branch — parent-only ownership without it passes the full suite —
105-
so #2754 step 1 keeps it with a case or deletes it deliberately, rather than inheriting it.
103+
- **The self case is resolved: a scroll-typed indicator owns nothing.** #2754 step 1 deleted the
104+
self-ownership branch. Reading a scroll-typed node labelled as an indicator onto its own band is a
105+
no-op (the indicator and container are the same rect, which `deriveScrollableViewportRect` refuses),
106+
while reading it onto its parent clips a sibling list to that host — the #2214 failure mirrored
107+
upward. So `findScrollIndicatorContainer` returns null when the node is itself a scroll type;
108+
`runner-presentation.test.ts` pins a scroll host labelled as an indicator leaving its parent list's
109+
band intact.
106110
- **macOS is already a second consumer of these rules.** Desktop capture runs the engine through
107111
`snapshot-desktop-surface.ts` → `ios-snapshot-runtime.ts` → `publishIosSnapshot`, and its trees carry
108112
`ScrollArea`, which neither eligible set admits. The parent-edge rule needs its own decision there

0 commit comments

Comments
 (0)