FAILURE MAP
← Case archive

FA-54151 / Accessibility interaction semantics / Open access

Text API reports anchor as active selection position · case 01

Text API reports anchor as active selection position.

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

ROOT CAUSE

The active focus decision in the text selection api adapter violates its declared contract.

VERIFIED REPAIR

Apply the exact contract at the active focus decision: ranges[-1][1] if ranges else None

Unsuccessful approach: The local repair substitutes ranges[0][1] if ranges else None but still mishandles the regression fixtures.

Case contract

Input [text_length,multi,readonly,selections,operation] selections ordered [anchor,focus]; operation [kind,index,anchor,focus]. API supports add,replace,remove,clear; readonly concerns text edits and does not prevent selecting. Validate endpoints inclusive0..length and index for replace/remove. add only when multi or no selection; remove preserves other ranges; clear ignores index. Return [ranges,success,active] where active is last range's focus or None. Preserve anchor direction and collapsed selections. Failure leaves input unchanged.

Why this case matters

Offline accessibility bridge model with explicit policy; useful for testing semantic API adapters independently of browser implementations.

1 / The failure

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

N = 1
observations = []
def solve(data):
    length,multi,readonly,selections,operation = data
    ranges = [list(x) for x in selections]
    kind,index,anchor,focus = operation
    ok = False
    if kind == 'clear': ranges,ok = [],True
    elif kind in ('add','replace') and 0 <= anchor <= length and 0 <= focus <= length:
        if kind == 'add' and (multi or not ranges): ranges.append([anchor,focus]); ok = True
        elif kind == 'replace' and 0 <= index < len(ranges): ranges[index] = [anchor,focus]; ok = True
    elif kind == 'remove' and 0 <= index < len(ranges): ranges.pop(index); ok = True
    return [ranges,ok,ranges[-1][0] if ranges else None]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('contract fixture 1', solve([N+5,True,False,[[0,1]],['add',0,N+3,N]],), [[[0,1],[N+3,N]],True,N])
check('contract fixture 2', solve([5,False,True,[],['add',0,5,5]],), [[[5,5]],True,5])
check('contract fixture 3', solve([5,False,False,[[0,1]],['add',0,2,3]],), [[[0,1]],False,1])
check('contract fixture 4', solve([5,True,False,[[0,1],[2,3]],['replace',0,4,2]],), [[[4,2],[2,3]],True,3])
check('contract fixture 5', solve([5,True,False,[[0,1],[2,3]],['remove',0,0,0]],), [[[2,3]],True,3])
check('contract fixture 6', solve([5,False,False,[[0,1]],['clear',99,-1,99]],), [[],True,None])
check('contract fixture 7', solve([5,True,False,[[0,1]],['replace',-1,2,3]],), [[[0,1]],False,1])
check('contract fixture 8', solve([5,True,False,[],['add',0,-1,3]],), [[],False,None])
check('contract fixture 9', solve([5,True,False,[],['add',0,1,6]],), [[],False,None])
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
contract fixture 1[[[0, 1], [4, 1]], True, 4][[[0, 1], [4, 1]], True, 1]Failed
contract fixture 2[[[5, 5]], True, 5][[[5, 5]], True, 5]Passed
contract fixture 3[[[0, 1]], False, 0][[[0, 1]], False, 1]Failed
contract fixture 4[[[4, 2], [2, 3]], True, 2][[[4, 2], [2, 3]], True, 3]Failed
contract fixture 5[[[2, 3]], True, 2][[[2, 3]], True, 3]Failed
contract fixture 6[[], True, None][[], True, None]Passed
contract fixture 7[[[0, 1]], False, 0][[[0, 1]], False, 1]Failed
contract fixture 8[[], False, None][[], False, None]Passed
contract fixture 9[[], False, None][[], False, None]Passed

SHA-256 / 1295cd3e4b3efadc9cb39ac54d09d7cc0901009f42bb38be6b965fd163e28f28

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(data):
    length,multi,readonly,selections,operation = data
    ranges = [list(x) for x in selections]
    kind,index,anchor,focus = operation
    ok = False
    if kind == 'clear': ranges,ok = [],True
    elif kind in ('add','replace') and 0 <= anchor <= length and 0 <= focus <= length:
        if kind == 'add' and (multi or not ranges): ranges.append([anchor,focus]); ok = True
        elif kind == 'replace' and 0 <= index < len(ranges): ranges[index] = [anchor,focus]; ok = True
    elif kind == 'remove' and 0 <= index < len(ranges): ranges.pop(index); ok = True
    return [ranges,ok,ranges[0][1] if ranges else None]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('contract fixture 1', solve([N+5,True,False,[[0,1]],['add',0,N+3,N]],), [[[0,1],[N+3,N]],True,N])
check('contract fixture 2', solve([5,False,True,[],['add',0,5,5]],), [[[5,5]],True,5])
check('contract fixture 3', solve([5,False,False,[[0,1]],['add',0,2,3]],), [[[0,1]],False,1])
check('contract fixture 4', solve([5,True,False,[[0,1],[2,3]],['replace',0,4,2]],), [[[4,2],[2,3]],True,3])
check('contract fixture 5', solve([5,True,False,[[0,1],[2,3]],['remove',0,0,0]],), [[[2,3]],True,3])
check('contract fixture 6', solve([5,False,False,[[0,1]],['clear',99,-1,99]],), [[],True,None])
check('contract fixture 7', solve([5,True,False,[[0,1]],['replace',-1,2,3]],), [[[0,1]],False,1])
check('contract fixture 8', solve([5,True,False,[],['add',0,-1,3]],), [[],False,None])
check('contract fixture 9', solve([5,True,False,[],['add',0,1,6]],), [[],False,None])
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
contract fixture 1[[[0, 1], [4, 1]], True, 1][[[0, 1], [4, 1]], True, 1]Passed
contract fixture 2[[[5, 5]], True, 5][[[5, 5]], True, 5]Passed
contract fixture 3[[[0, 1]], False, 1][[[0, 1]], False, 1]Passed
contract fixture 4[[[4, 2], [2, 3]], True, 2][[[4, 2], [2, 3]], True, 3]Failed
contract fixture 5[[[2, 3]], True, 3][[[2, 3]], True, 3]Passed
contract fixture 6[[], True, None][[], True, None]Passed
contract fixture 7[[[0, 1]], False, 1][[[0, 1]], False, 1]Passed
contract fixture 8[[], False, None][[], False, None]Passed
contract fixture 9[[], False, None][[], False, None]Passed

SHA-256 / 08c64635c8e4cc6b693c03084c4da2a89c0002e6366f5e19b72fc36dc369086f

3 / The verified repair

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

N = 1
observations = []
def solve(data):
    length,multi,readonly,selections,operation = data
    ranges = [list(x) for x in selections]
    kind,index,anchor,focus = operation
    ok = False
    if kind == 'clear': ranges,ok = [],True
    elif kind in ('add','replace') and 0 <= anchor <= length and 0 <= focus <= length:
        if kind == 'add' and (multi or not ranges): ranges.append([anchor,focus]); ok = True
        elif kind == 'replace' and 0 <= index < len(ranges): ranges[index] = [anchor,focus]; ok = True
    elif kind == 'remove' and 0 <= index < len(ranges): ranges.pop(index); ok = True
    return [ranges,ok,ranges[-1][1] if ranges else None]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('contract fixture 1', solve([N+5,True,False,[[0,1]],['add',0,N+3,N]],), [[[0,1],[N+3,N]],True,N])
check('contract fixture 2', solve([5,False,True,[],['add',0,5,5]],), [[[5,5]],True,5])
check('contract fixture 3', solve([5,False,False,[[0,1]],['add',0,2,3]],), [[[0,1]],False,1])
check('contract fixture 4', solve([5,True,False,[[0,1],[2,3]],['replace',0,4,2]],), [[[4,2],[2,3]],True,3])
check('contract fixture 5', solve([5,True,False,[[0,1],[2,3]],['remove',0,0,0]],), [[[2,3]],True,3])
check('contract fixture 6', solve([5,False,False,[[0,1]],['clear',99,-1,99]],), [[],True,None])
check('contract fixture 7', solve([5,True,False,[[0,1]],['replace',-1,2,3]],), [[[0,1]],False,1])
check('contract fixture 8', solve([5,True,False,[],['add',0,-1,3]],), [[],False,None])
check('contract fixture 9', solve([5,True,False,[],['add',0,1,6]],), [[],False,None])
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
contract fixture 1[[[0, 1], [4, 1]], True, 1][[[0, 1], [4, 1]], True, 1]Passed
contract fixture 2[[[5, 5]], True, 5][[[5, 5]], True, 5]Passed
contract fixture 3[[[0, 1]], False, 1][[[0, 1]], False, 1]Passed
contract fixture 4[[[4, 2], [2, 3]], True, 3][[[4, 2], [2, 3]], True, 3]Passed
contract fixture 5[[[2, 3]], True, 3][[[2, 3]], True, 3]Passed
contract fixture 6[[], True, None][[], True, None]Passed
contract fixture 7[[[0, 1]], False, 1][[[0, 1]], False, 1]Passed
contract fixture 8[[], False, None][[], False, None]Passed
contract fixture 9[[], False, None][[], False, None]Passed

SHA-256 / 725d4c725ca86d34b902a3c9b4d163c4933039170364ca138cf49147fdc9964a

Verification & scope

Stipulated finite adapter contract, not a claim of platform accessibility or ARIA conformance. 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:45:45.729295+00:00.

Case digest / d653453208d1f20d2352ab96fab8a7ea0664596e47621d0aa960a25885b83c5b