{"abstract":"Restoration selects an outer rather than the newest live target.","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.","evaluation_group":"xi-focus-scope","failed_approach":"Alphabetical ordering has no relation to scope nesting.","family":"xi-focus-scope-restore-order","id":"FA-7866","implementations":{"attempt":{"sha256":"59a637e95b4ab0a2d9e995968d09a39a4ecc88691ab885ac297f3d20f5261ae8","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 sorted(stack) if x in connected), None)\n    if event == 'escape': return stack[:-1] if stack else []\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":"4013513a8bbefe948e3fe41ed3c0f2804214521f04f7c01e274d9e3f31e0be32","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 stack if x in connected), None)\n    if event == 'escape': return stack[:-1] if stack else []\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"},"fixed":{"sha256":"8901a8b8c65cfc32a871a684954e66a19f6e67cb2db84f1b471e3d704b7c9981","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[:-1] if stack else []\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-restore-order","generated_at":"2026-09-29T14:38:16.091580+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.","repair":"Implement the restore order operation as `reversed(stack)`.","root_cause":"The restore order operation uses `stack` where the contract requires `reversed(stack)`.","sha256":"34825c92d551505604ddff19c092ca65a9315a4ea33dc59a6fe56fce98d64e2d","title":"Modal focus restoration: Restoration selects an outer rather than the newest live target · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verification":{"attempt":{"elapsed_ms":40.81,"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":"a","check":"ordered newest","expected":"z","passed":false},{"actual":"outer","check":"detached","expected":"outer","passed":true},{"actual":["outer"],"check":"escape one","expected":["outer"],"passed":true},{"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\": \"a\", \"expected\": \"z\", \"passed\": false}, {\"check\": \"detached\", \"actual\": \"outer\", \"expected\": \"outer\", \"passed\": true}, {\"check\": \"escape one\", \"actual\": [\"outer\"], \"expected\": [\"outer\"], \"passed\": true}, {\"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":42.622,"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":"z","check":"newest live","expected":"a","passed":false},{"actual":"a","check":"ordered newest","expected":"z","passed":false},{"actual":"outer","check":"detached","expected":"outer","passed":true},{"actual":["outer"],"check":"escape one","expected":["outer"],"passed":true},{"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\": \"z\", \"expected\": \"a\", \"passed\": false}, {\"check\": \"ordered newest\", \"actual\": \"a\", \"expected\": \"z\", \"passed\": false}, {\"check\": \"detached\", \"actual\": \"outer\", \"expected\": \"outer\", \"passed\": true}, {\"check\": \"escape one\", \"actual\": [\"outer\"], \"expected\": [\"outer\"], \"passed\": true}, {\"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"},"fixed":{"elapsed_ms":40.674,"exit_code":0,"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"],"check":"escape one","expected":["outer"],"passed":true},{"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":true,"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\"], \"expected\": [\"outer\"], \"passed\": true}, {\"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\": true}\n"}},"verified":true,"visibility":"public"}