{"abstract":"Escape leaves the active focus scope installed.","category":"Keyboard accessibility","checks":9,"contract":"Opening pushes one return target; closing or Escape pops one scope; restoration chooses the newest connected target; clear empties the stack.","contract_signature":"stack, event, target, connected","evaluation_group":"xi-focus-scope","failed_approach":"Clearing every scope loses still-open outer dialogs.","family":"xi-focus-scope-escape","id":"FA-7876","implementations":{"attempt":{"sha256":"ec9fb672adf6d3e850563a9acaddcfbc7fb6cf2b3de89e6c75184d300d4d731e","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(stack, event, target, connected):\n    stack = list(stack)\n    if event == 'open': return stack + [target]\n    if event == 'close': return stack[:-1]\n    if event == 'restore': return next((x for x in reversed(stack) if x in connected), None)\n    if event == 'escape': return []\n    if event == 'clear': return []\n    return stack\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('nested open', solve(['outer'], 'open', 'inner', []), ['outer', 'inner'])\ncheck('nested close', solve(['outer','inner'], 'close', None, []), ['outer'])\ncheck('newest live', solve(['z','a'], 'restore', None, ['z','a']), 'a')\ncheck('ordered newest', solve(['a','z'], 'restore', None, ['a','z']), 'z')\ncheck('detached', solve(['outer','gone'], 'restore', None, ['outer']), 'outer')\ncheck('escape one', solve(['outer','inner'], 'escape', None, []), ['outer'])\ncheck('clear', solve(['outer'], 'clear', None, []), [])\ncheck('parameterized opener', solve(['outer'], 'open', 'dialog'+str(N), []), ['outer', 'dialog'+str(N)])\nfor repetition in range(N):\n    check('repeat clear', solve(['outer'], 'clear', None, []), [])\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"},"broken":{"sha256":"32a073b463ed06a9293e0831ab0943cfa4ca5c4f53b71939a0ce984505043b7e","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(stack, event, target, connected):\n    stack = list(stack)\n    if event == 'open': return stack + [target]\n    if event == 'close': return stack[:-1]\n    if event == 'restore': return next((x for x in reversed(stack) if x in connected), None)\n    if event == 'escape': return stack\n    if event == 'clear': return []\n    return stack\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\ncheck('nested open', solve(['outer'], 'open', 'inner', []), ['outer', 'inner'])\ncheck('nested close', solve(['outer','inner'], 'close', None, []), ['outer'])\ncheck('newest live', solve(['z','a'], 'restore', None, ['z','a']), 'a')\ncheck('ordered newest', solve(['a','z'], 'restore', None, ['a','z']), 'z')\ncheck('detached', solve(['outer','gone'], 'restore', None, ['outer']), 'outer')\ncheck('escape one', solve(['outer','inner'], 'escape', None, []), ['outer'])\ncheck('clear', solve(['outer'], 'clear', None, []), [])\ncheck('parameterized opener', solve(['outer'], 'open', 'dialog'+str(N), []), ['outer', 'dialog'+str(N)])\nfor repetition in range(N):\n    check('repeat clear', solve(['outer'], 'clear', None, []), [])\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"}},"limitations":" 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.","method":"Deterministic executable model with adversarial boundary fixtures.","provenance":{"created_by":"Failure Map","dependencies":"Python standard library","family":"xi-focus-scope-escape","generated_at":"2026-09-29T14:38:16.127797+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"A deterministic model of modal focus restoration; this isolates one interface invariant without requiring a browser.","root_cause":"The escape operation uses `if event == 'escape': return stack` where the contract requires `if event == 'escape': return stack[:-1] if stack else []`.","sha256":"9a427b9379418edc29454d5c881eb8f932b6eeafa759614423f8dc9320fb8d25","title":"Modal focus restoration: Escape leaves the active focus scope installed · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verified":true,"visibility":"public","verification":{"attempt":{"elapsed_ms":40.439,"exit_code":1,"observations":[{"actual":["outer","inner"],"check":"nested open","expected":["outer","inner"],"passed":true},{"actual":["outer"],"check":"nested close","expected":["outer"],"passed":true},{"actual":"a","check":"newest live","expected":"a","passed":true},{"actual":"z","check":"ordered newest","expected":"z","passed":true},{"actual":"outer","check":"detached","expected":"outer","passed":true},{"actual":[],"check":"escape one","expected":["outer"],"passed":false},{"actual":[],"check":"clear","expected":[],"passed":true},{"actual":["outer","dialog1"],"check":"parameterized opener","expected":["outer","dialog1"],"passed":true},{"actual":[],"check":"repeat clear","expected":[],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"nested open\", \"actual\": [\"outer\", \"inner\"], \"expected\": [\"outer\", \"inner\"], \"passed\": true}, {\"check\": \"nested close\", \"actual\": [\"outer\"], \"expected\": [\"outer\"], \"passed\": true}, {\"check\": \"newest live\", \"actual\": \"a\", \"expected\": \"a\", \"passed\": true}, {\"check\": \"ordered newest\", \"actual\": \"z\", \"expected\": \"z\", \"passed\": true}, {\"check\": \"detached\", \"actual\": \"outer\", \"expected\": \"outer\", \"passed\": true}, {\"check\": \"escape one\", \"actual\": [], \"expected\": [\"outer\"], \"passed\": false}, {\"check\": \"clear\", \"actual\": [], \"expected\": [], \"passed\": true}, {\"check\": \"parameterized opener\", \"actual\": [\"outer\", \"dialog1\"], \"expected\": [\"outer\", \"dialog1\"], \"passed\": true}, {\"check\": \"repeat clear\", \"actual\": [], \"expected\": [], \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":40.295,"exit_code":1,"observations":[{"actual":["outer","inner"],"check":"nested open","expected":["outer","inner"],"passed":true},{"actual":["outer"],"check":"nested close","expected":["outer"],"passed":true},{"actual":"a","check":"newest live","expected":"a","passed":true},{"actual":"z","check":"ordered newest","expected":"z","passed":true},{"actual":"outer","check":"detached","expected":"outer","passed":true},{"actual":["outer","inner"],"check":"escape one","expected":["outer"],"passed":false},{"actual":[],"check":"clear","expected":[],"passed":true},{"actual":["outer","dialog1"],"check":"parameterized opener","expected":["outer","dialog1"],"passed":true},{"actual":[],"check":"repeat clear","expected":[],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"nested open\", \"actual\": [\"outer\", \"inner\"], \"expected\": [\"outer\", \"inner\"], \"passed\": true}, {\"check\": \"nested close\", \"actual\": [\"outer\"], \"expected\": [\"outer\"], \"passed\": true}, {\"check\": \"newest live\", \"actual\": \"a\", \"expected\": \"a\", \"passed\": true}, {\"check\": \"ordered newest\", \"actual\": \"z\", \"expected\": \"z\", \"passed\": true}, {\"check\": \"detached\", \"actual\": \"outer\", \"expected\": \"outer\", \"passed\": true}, {\"check\": \"escape one\", \"actual\": [\"outer\", \"inner\"], \"expected\": [\"outer\"], \"passed\": false}, {\"check\": \"clear\", \"actual\": [], \"expected\": [], \"passed\": true}, {\"check\": \"parameterized opener\", \"actual\": [\"outer\", \"dialog1\"], \"expected\": [\"outer\", \"dialog1\"], \"passed\": true}, {\"check\": \"repeat clear\", \"actual\": [], \"expected\": [], \"passed\": true}], \"passed\": false}\n"}},"member_only":{"stages":["fixed"],"fields":["implementations.fixed","verification.fixed","harness","repair"],"note":"The verified repair, its recorded checks, the repair description, and the scoring harness are available to members."}}