FAILURE MAP
← Case archive

FA-9001 / Text editing / Open access

Composition-aware keyboard commands: Shift-Tab moves focus forward · case 01

Shift-Tab moves focus forward.

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

ROOT CAUSE

The shift tab operation uses `'next'` where the contract requires `'previous' if shift else 'next'`.

VERIFIED REPAIR

Implement the shift tab operation as `'previous' if shift else 'next'`.

Unsuccessful approach: Always moving backward breaks ordinary Tab.

Case contract

Composition state or legacy code 229 delegates to native input; plain multiline Enter inserts newline; other Enter submits; Escape preserves draft; Tab honors Shift.

Why this case matters

A deterministic model of composition-aware keyboard commands; 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(key, composing, code, shift, multiline, value):
    if composing or code == 229: return ('native', value)
    if key == 'Enter':
        if multiline and not shift: return ('insert', value + '\n')
        return ('submit', value)
    if key == 'Escape': return ('cancel', value)
    if key == 'Tab': return ('next', value)
    return ('native', value)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('composition', solve('Enter', True, 13, False, False, 'draft'), ('native', 'draft'))
check('legacy', solve('Enter', False, 229, False, False, 'draft'), ('native', 'draft'))
check('single', solve('Enter', False, 13, False, False, 'draft'), ('submit', 'draft'))
check('multiline', solve('Enter', False, 13, False, True, 'draft'), ('insert', 'draft\n'))
check('shift submit', solve('Enter', False, 13, True, True, 'draft'), ('submit', 'draft'))
check('escape', solve('Escape', False, 27, False, False, 'draft'), ('cancel', 'draft'))
check('shift tab', solve('Tab', False, 9, True, False, 'draft'), ('previous', 'draft'))
check('tab', solve('Tab', False, 9, False, False, 'draft'), ('next', 'draft'))
check('parameterized composition text', solve('Enter',True,13,False,False,'draft'+str(N)), ('native','draft'+str(N)))
for repetition in range(N):
    check('repeat tab', solve('Tab', False, 9, False, False, 'draft'), ('next', 'draft'))
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
composition['native', 'draft']['native', 'draft']Passed
legacy['native', 'draft']['native', 'draft']Passed
single['submit', 'draft']['submit', 'draft']Passed
multiline['insert', 'draft\n']['insert', 'draft\n']Passed
shift submit['submit', 'draft']['submit', 'draft']Passed
escape['cancel', 'draft']['cancel', 'draft']Passed
shift tab['next', 'draft']['previous', 'draft']Failed
tab['next', 'draft']['next', 'draft']Passed
parameterized composition text['native', 'draft1']['native', 'draft1']Passed
repeat tab['next', 'draft']['next', 'draft']Passed

SHA-256 / 57220b8ec44aa818ba05c1ed4ae5177d6853b7af7dfc0f102f1eb360d31926dc

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(key, composing, code, shift, multiline, value):
    if composing or code == 229: return ('native', value)
    if key == 'Enter':
        if multiline and not shift: return ('insert', value + '\n')
        return ('submit', value)
    if key == 'Escape': return ('cancel', value)
    if key == 'Tab': return ('previous', value)
    return ('native', value)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('composition', solve('Enter', True, 13, False, False, 'draft'), ('native', 'draft'))
check('legacy', solve('Enter', False, 229, False, False, 'draft'), ('native', 'draft'))
check('single', solve('Enter', False, 13, False, False, 'draft'), ('submit', 'draft'))
check('multiline', solve('Enter', False, 13, False, True, 'draft'), ('insert', 'draft\n'))
check('shift submit', solve('Enter', False, 13, True, True, 'draft'), ('submit', 'draft'))
check('escape', solve('Escape', False, 27, False, False, 'draft'), ('cancel', 'draft'))
check('shift tab', solve('Tab', False, 9, True, False, 'draft'), ('previous', 'draft'))
check('tab', solve('Tab', False, 9, False, False, 'draft'), ('next', 'draft'))
check('parameterized composition text', solve('Enter',True,13,False,False,'draft'+str(N)), ('native','draft'+str(N)))
for repetition in range(N):
    check('repeat tab', solve('Tab', False, 9, False, False, 'draft'), ('next', 'draft'))
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
composition['native', 'draft']['native', 'draft']Passed
legacy['native', 'draft']['native', 'draft']Passed
single['submit', 'draft']['submit', 'draft']Passed
multiline['insert', 'draft\n']['insert', 'draft\n']Passed
shift submit['submit', 'draft']['submit', 'draft']Passed
escape['cancel', 'draft']['cancel', 'draft']Passed
shift tab['previous', 'draft']['previous', 'draft']Passed
tab['previous', 'draft']['next', 'draft']Failed
parameterized composition text['native', 'draft1']['native', 'draft1']Passed
repeat tab['previous', 'draft']['next', 'draft']Failed

SHA-256 / 634b9566ea6c15d559c962f1829b11be9aca89c36c4cd1d11efb6d7911e3e5bb

3 / The verified repair

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

N = 1
observations = []
def solve(key, composing, code, shift, multiline, value):
    if composing or code == 229: return ('native', value)
    if key == 'Enter':
        if multiline and not shift: return ('insert', value + '\n')
        return ('submit', value)
    if key == 'Escape': return ('cancel', value)
    if key == 'Tab': return ('previous' if shift else 'next', value)
    return ('native', value)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('composition', solve('Enter', True, 13, False, False, 'draft'), ('native', 'draft'))
check('legacy', solve('Enter', False, 229, False, False, 'draft'), ('native', 'draft'))
check('single', solve('Enter', False, 13, False, False, 'draft'), ('submit', 'draft'))
check('multiline', solve('Enter', False, 13, False, True, 'draft'), ('insert', 'draft\n'))
check('shift submit', solve('Enter', False, 13, True, True, 'draft'), ('submit', 'draft'))
check('escape', solve('Escape', False, 27, False, False, 'draft'), ('cancel', 'draft'))
check('shift tab', solve('Tab', False, 9, True, False, 'draft'), ('previous', 'draft'))
check('tab', solve('Tab', False, 9, False, False, 'draft'), ('next', 'draft'))
check('parameterized composition text', solve('Enter',True,13,False,False,'draft'+str(N)), ('native','draft'+str(N)))
for repetition in range(N):
    check('repeat tab', solve('Tab', False, 9, False, False, 'draft'), ('next', 'draft'))
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
composition['native', 'draft']['native', 'draft']Passed
legacy['native', 'draft']['native', 'draft']Passed
single['submit', 'draft']['submit', 'draft']Passed
multiline['insert', 'draft\n']['insert', 'draft\n']Passed
shift submit['submit', 'draft']['submit', 'draft']Passed
escape['cancel', 'draft']['cancel', 'draft']Passed
shift tab['previous', 'draft']['previous', 'draft']Passed
tab['next', 'draft']['next', 'draft']Passed
parameterized composition text['native', 'draft1']['native', 'draft1']Passed
repeat tab['next', 'draft']['next', 'draft']Passed

SHA-256 / ea291435c849164eabbf63da7f76ca4e3bbbb91381ca534736a97dfccb6a5d51

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:26.215105+00:00.

Case digest / e57536ee8e4d9c35123b39a7847863068346232ac9637ff26ef7d7f537dde80e