Skip to content

Commit 35d4071

Browse files
committed
fix(scroll): answer with the movement a directional scroll observed
1 parent d97aba9 commit 35d4071

4 files changed

Lines changed: 427 additions & 41 deletions

File tree

‎packages/contracts/src/platform-runtime-operations.ts‎

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,8 +250,22 @@ const gestureTargetAuthoredDragUse = defineUse({
250250
*/
251251
export const gestureViewportRuntimeUse = defineUse({ required: ['gestureViewport'] });
252252

253-
/** `scroll <direction>` executes one pass and needs nothing else. */
254-
const scrollDirectionUse = defineUse({ required: ['scrollDirection'] });
253+
/**
254+
* `scroll <direction>` executes one pass, and the capture that lets it answer with the movement it
255+
* observed (#2714) is CONDITIONAL — not `preferred`, not `required` (ADR 0019 §2). Not preferred:
256+
* the observation is what makes the direction tier's answer honest, which is correctness rather
257+
* than a faster path, and §2 reserves `preferred` for optimizations that never carry correctness.
258+
* Not required: a runtime that cannot read a screen still scrolls, and `movement: 'unobserved'` —
259+
* or no movement field at all — is the answer it owes.
260+
*
261+
* Both sides are complete. An owner that can capture answers with the movement it saw; an owner that
262+
* cannot answers exactly the response it answered before, distance and all. `scroll-runtime.test.ts`
263+
* pins one case per side of that parity.
264+
*/
265+
const scrollDirectionUse = defineUse({
266+
required: ['scrollDirection'],
267+
conditional: ['captureSnapshot'],
268+
});
255269
/**
256270
* Every scroll that verifies between passes: `scroll top`/`scroll bottom` read hidden content at
257271
* the edge, and `scroll --until <selector>` re-reads the tree to decide whether the target came

0 commit comments

Comments
 (0)