Skip to content

Commit e24d8fe

Browse files
committed
fix(snapshot): drop the parent-sized chrome rule, keep the top-inset footprint
The regular iOS projection collapses duplicate identities and presents the floating-bar containers as application-level siblings, so a container never matches its presented parent. A live iPhone 18 Pro Max iOS 27.0 capture shows both containers under the application: the y=64 pair exempt each other and the y=2 container needs only the top-inset footprint. The parent-sized rule, its three tests, and the pruning claim in its comment go; the raw tree the issue carries is the raw projection, which the daemon never annotates.
1 parent c2b7554 commit e24d8fe

2 files changed

Lines changed: 3 additions & 101 deletions

File tree

‎packages/capture-kit/src/snapshot-occlusion-sibling-sized-chrome.test.ts‎

Lines changed: 0 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -723,67 +723,3 @@ test('a control the exempt toolbar host really hosts still covers the row it ove
723723

724724
assert.deepEqual(coveredLabels(nodes), ['Barless row 12']);
725725
});
726-
727-
/**
728-
* The iOS 27 runner shape from a React Native tab screen on an iPhone 18 Pro Max: the content branch
729-
* starts under the header at y=2, the layout container and its `_UIFloatingBarContainerView` start
730-
* at y=64, and the wrapper that matched the container in the raw tree has been pruned.
731-
*/
732-
function parentSizedTree(deltas: { branchRect?: Rect; chromeRect?: Rect } = {}): RawSnapshotNode[] {
733-
const viewport: Rect = { x: 0, y: 0, width: 440, height: 956 };
734-
const layout: Rect = { x: 0, y: 64, width: 440, height: 892 };
735-
return [
736-
node({ index: 0, depth: 0, type: 'Application', rect: viewport }),
737-
node({ index: 1, parentIndex: 0, depth: 1, type: 'Window', rect: viewport, hittable: true }),
738-
node({ index: 2, parentIndex: 1, depth: 2, type: 'Other', rect: layout, hittable: true }),
739-
node({
740-
index: 3,
741-
parentIndex: 2,
742-
depth: 3,
743-
type: 'Other',
744-
rect: deltas.branchRect ?? { x: 0, y: 2, width: 440, height: 954 },
745-
hittable: true,
746-
}),
747-
node({
748-
index: 4,
749-
parentIndex: 3,
750-
depth: 4,
751-
type: 'Other',
752-
label: 'Rooms',
753-
rect: { x: 16, y: 313, width: 408, height: 46 },
754-
hittable: true,
755-
}),
756-
node({
757-
index: 5,
758-
parentIndex: 2,
759-
depth: 3,
760-
type: 'Toolbar',
761-
label: 'Toolbar',
762-
rect: deltas.chromeRect ?? layout,
763-
hittable: true,
764-
}),
765-
];
766-
}
767-
768-
test('a chrome container sized to its parent beside a branch that encloses it does not cover that branch', () => {
769-
const target = targetVerdict(parentSizedTree());
770-
771-
assert.equal(target?.interactionBlocked, undefined);
772-
});
773-
774-
test('a parent-sized chrome container still covers when no sibling encloses it', () => {
775-
// A bar alone in a same-size wrapper, beside a branch shorter than the bar, keeps covering.
776-
const target = targetVerdict(
777-
parentSizedTree({ branchRect: { x: 0, y: 64, width: 440, height: 700 } }),
778-
);
779-
780-
assert.equal(target?.interactionBlocked, 'covered');
781-
});
782-
783-
test('a chrome container smaller than its parent still covers the branch beside it', () => {
784-
const target = targetVerdict(
785-
parentSizedTree({ chromeRect: { x: 0, y: 64, width: 440, height: 600 } }),
786-
);
787-
788-
assert.equal(target?.interactionBlocked, 'covered');
789-
});

‎packages/capture-kit/src/snapshot-occlusion.ts‎

Lines changed: 3 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -368,43 +368,9 @@ function isSiblingSizedChromeContainer(
368368
const rect = positiveRect(node.rect);
369369
if (!rect) return false;
370370
const siblings = neighbourhood.childrenByParent.get(node.parentIndex) ?? [];
371-
if (
372-
siblings.some(
373-
(sibling) => sibling.index !== node.index && areRectsApproximatelyEqual(rect, sibling.rect),
374-
)
375-
) {
376-
return true;
377-
}
378-
const parent = neighbourhood.byIndex.get(node.parentIndex);
379-
return Boolean(parent && isParentSizedBesideEnclosingBranch(node, rect, parent, siblings));
380-
}
381-
382-
/**
383-
* The same footprint after the runner has pruned the sibling that matched it. On iOS 27 a React
384-
* Native tab screen's content branch extends under the header (`0,2,440,954`) while its
385-
* `_UIFloatingBarContainerView` keeps the layout container's frame (`0,64,440,892`), and the
386-
* container-sized wrapper the raw tree lists beside it is dropped as an empty `Other`. The container
387-
* then matches its parent, and a sibling branch encloses it.
388-
*
389-
* Requiring the enclosing sibling keeps a bar that merely fills a same-size wrapper covering: a
390-
* navigation or tool bar wrapped on its own has no sibling at least as large as itself.
391-
*
392-
* Accepted limit: a bar that fills a bar-sized wrapper, beside a sibling that overflows that wrapper
393-
* (a backdrop larger than the bar), is exempt too, and stops covering content under it that the
394-
* sibling does not hold. No capture shows that shape.
395-
*/
396-
function isParentSizedBesideEnclosingBranch(
397-
node: RawSnapshotNode,
398-
rect: Rect,
399-
parent: RawSnapshotNode,
400-
siblings: readonly RawSnapshotNode[],
401-
): boolean {
402-
if (!areRectsApproximatelyEqual(rect, parent.rect)) return false;
403-
return siblings.some((sibling) => {
404-
if (sibling.index === node.index) return false;
405-
const siblingRect = positiveRect(sibling.rect);
406-
return Boolean(siblingRect && rectContains(siblingRect, rect));
407-
});
371+
return siblings.some(
372+
(sibling) => sibling.index !== node.index && areRectsApproximatelyEqual(rect, sibling.rect),
373+
);
408374
}
409375

410376
/**

0 commit comments

Comments
 (0)