FAILURE MAP
← Case archive

FA-8296 / Viewport layout / Open access

Nearest-edge scroll reveal: Visible targets unnecessarily change the scroll position · case 01

Visible targets unnecessarily change the scroll position.

Verified by executionVariant 1 · 8 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

The already visible operation uses `else: wanted = start` where the contract requires `else: wanted = offset`.

VERIFIED REPAIR

Implement the already visible operation as `else: wanted = offset`.

Unsuccessful approach: Aligning their end also moves the viewport despite full visibility.

Case contract

Keep already-visible items stationary; reveal nearest edge; align oversized items at the start; clamp offset to the scrollable extent.

Why this case matters

A deterministic model of nearest-edge scroll reveal; this isolates one interface invariant without requiring a browser.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(start, end, offset, viewport, extent):
    if end - start > viewport: wanted = start
    elif start < offset: wanted = start
    elif end > offset + viewport: wanted = end - viewport
    else: wanted = start
    return max(0, min(wanted, max(0, extent - viewport)))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('oversized', solve(10, 40, 0, 20, 100), 10)
check('above', solve(10, 15, 30, 20, 100), 10)
check('below', solve(40, 45, 0, 20, 100), 25)
check('visible', solve(12, 15, 10, 20, 100), 10)
check('end clamp', solve(95, 105, 0, 20, 100), 80)
check('negative clamp', solve(-5, 0, 10, 20, 100), 0)
check('parameterized reveal distance', solve(10*N, 10*N+5, 0, 10, 100*N), 10*N-5)
for repetition in range(N):
    check('repeat negative clamp', solve(-5, 0, 10, 20, 100), 0)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
oversized1010Passed
above1010Passed
below2525Passed
visible1210Failed
end clamp8080Passed
negative clamp00Passed
parameterized reveal distance55Passed
repeat negative clamp00Passed

SHA-256 / e69627bcb6cfbed7072500474a8e57794a7452c2797c8711a6bfb5cf82279bb2

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(start, end, offset, viewport, extent):
    if end - start > viewport: wanted = start
    elif start < offset: wanted = start
    elif end > offset + viewport: wanted = end - viewport
    else: wanted = end
    return max(0, min(wanted, max(0, extent - viewport)))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('oversized', solve(10, 40, 0, 20, 100), 10)
check('above', solve(10, 15, 30, 20, 100), 10)
check('below', solve(40, 45, 0, 20, 100), 25)
check('visible', solve(12, 15, 10, 20, 100), 10)
check('end clamp', solve(95, 105, 0, 20, 100), 80)
check('negative clamp', solve(-5, 0, 10, 20, 100), 0)
check('parameterized reveal distance', solve(10*N, 10*N+5, 0, 10, 100*N), 10*N-5)
for repetition in range(N):
    check('repeat negative clamp', solve(-5, 0, 10, 20, 100), 0)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
oversized1010Passed
above1010Passed
below2525Passed
visible1510Failed
end clamp8080Passed
negative clamp00Passed
parameterized reveal distance55Passed
repeat negative clamp00Passed

SHA-256 / 9309cafe7f6f0e41661bcbb0554fef134bf3f875f1235e5da2e5d589ea5e96ee

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(start, end, offset, viewport, extent):
    if end - start > viewport: wanted = start
    elif start < offset: wanted = start
    elif end > offset + viewport: wanted = end - viewport
    else: wanted = offset
    return max(0, min(wanted, max(0, extent - viewport)))
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('oversized', solve(10, 40, 0, 20, 100), 10)
check('above', solve(10, 15, 30, 20, 100), 10)
check('below', solve(40, 45, 0, 20, 100), 25)
check('visible', solve(12, 15, 10, 20, 100), 10)
check('end clamp', solve(95, 105, 0, 20, 100), 80)
check('negative clamp', solve(-5, 0, 10, 20, 100), 0)
check('parameterized reveal distance', solve(10*N, 10*N+5, 0, 10, 100*N), 10*N-5)
for repetition in range(N):
    check('repeat negative clamp', solve(-5, 0, 10, 20, 100), 0)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
Boundary fixtureActualExpectedOutcome
oversized1010Passed
above1010Passed
below2525Passed
visible1010Passed
end clamp8080Passed
negative clamp00Passed
parameterized reveal distance55Passed
repeat negative clamp00Passed

SHA-256 / 6a5f0c7331a624886abbb02472a165ee031bb194fe054a1c783c6057aee33ed8

Verification & scope

This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.

Observations recorded using Python 3.12.14 at 2026-09-29T14:38:20.166405+00:00.

Case digest / 4e81b11f0f14628526c0d640dc1cebb2f0175af4db68aec4bb57825cf8a7fa6a