Keep busy dialogs keyboard reachable after native focus loss
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
# Shared native dialog focus recovery
|
||||
|
||||
Owned production change: only `wwwroot/js/dialog-focus.js`, shared inside this AdminUI consumer. No ModalFrame API, managed wrapper, package, style, authorization or backend change. Existing one-active-overlay and id/generation contracts remain; no nesting framework was extracted.
|
||||
|
||||
Actual browser evidence in the Raw workflow exposed focus falling to body when Connect was removed. Disabling a focused mutation control has the same native DOM behavior. An element-only keydown trap cannot then receive Tab/Escape, so a busy dialog could lose keyboard containment and a dismissible read could stop responding to Escape.
|
||||
|
||||
## Correction
|
||||
|
||||
Current-generation update now reanchors only when focus has left the current connected, non-inert modal, choosing its usable safe initial control or the modal root when busy has disabled every action. An already focused control/root is retained. Deliberate focus inside a different dialog is never stolen.
|
||||
|
||||
The original modal-local keydown listener remains in place so handled Escape stops before ancestor shortcuts, exactly as before. A document **capture** listener handles only outside-target gaps before background ancestor shortcuts; events whose targets are inside the modal are ignored by that fallback. This avoids double handling and preserves child-widget stopPropagation behavior. Both listeners are removed on deactivation. Current presentation identity/generation and other-dialog focus checks apply to keyboard handling; no global focusin hook, timer or MutationObserver expansion was added.
|
||||
|
||||
The root caller separately keeps its read-only Connect→Refresh node mounted with aria-disabled and server entry guards. This adapter correction is still needed for genuinely disabled mutation controls and removal gaps in any wrapper.
|
||||
|
||||
## Meaningful native regressions
|
||||
|
||||
`check_dialog_focus_recovery.py` executes the actual production adapter in Chromium over a synthetic local document and recording receiver, with real DOM focus, disabled fieldsets, inert, Tab/Shift+Tab and Escape. It uses no application host, network, operational service or database.
|
||||
|
||||
- `red.json`: four of six scenes failed; stale-generation and other-dialog positive controls passed.
|
||||
- `red-complete.json`: same four failures with 37 checks, including Escape reaching a background shortcut from the body gap. Busy/removed focus recovery, zero-control Tab/reverse-Tab containment and dismissible-read Escape were missing.
|
||||
- `green-final.json`: **9/9 scenes /51 checks passed**, no page errors. The original six scenes plus child-handled Escape, local ancestor-shortcut ordering and deactivation listener cleanup all pass. Native disabling/removal produced the actual body-focus gap; the tests do not set a fabricated component field to simulate it. The separate document-key scene deliberately blurs the current root to reproduce the interval between DOM mutation and a subsequent update.
|
||||
- `existing-native-final.json`: **10/10 existing native adapter cases passed**, covering safe entry, focus containment, removed/disabled/hidden/unfocusable trigger fallback, heading/landmark preference, preserved tabindex, and restored pre-existing inert/body state. The established check_native_dialog.py source was executed unchanged except redirecting its JSON destination into this owned evidence directory. Its original OT01 evidence was not overwritten.
|
||||
|
||||
Final production JS SHA-256: `7f63bd6c5181d0b70edc2e87e086fab4dfba96adabd7a19737f9b3b4f18296d5`.
|
||||
|
||||
An intermediate document-only bubble implementation passed the six direct focus scenarios. Source review identified local ancestor ordering, so the local listener was retained. Parent then identified the outside-body-gap ordering case: `outside-capture-red.json` records two meaningful failures (7/9 scenes), because a body ancestor shortcut acted before the document bubble fallback. The final outside-target capture listener passes both cases while its inside-target skip preserves child/local handling. Intermediate logs are historical, not final source acceptance. No test assertion was relaxed.
|
||||
|
||||
Reproduce from the OtOpcUa repository root:
|
||||
|
||||
```sh
|
||||
python3 infra/tools/ui-consistency/check_dialog_focus_recovery.py --output docs/ui-consistency/evidence/ot13-dialog-focus-recovery/green-final.json
|
||||
```
|
||||
|
||||
This is native adapter behavior, not manual assistive-technology certification or a complete composed modal/fleet gate. All workers were notified of the exact frozen hash and must verify served bytes in their final source-linked native matrices. Managed tests were not rerun for this JavaScript-only change; final combined consumer tests remain coordinator-owned. The temporary browser contexts close at harness completion, and no host/service/container lifecycle was changed.
|
||||
@@ -0,0 +1,100 @@
|
||||
[
|
||||
{
|
||||
"trigger": true,
|
||||
"heading": false,
|
||||
"inert": false,
|
||||
"bodyLocked": false,
|
||||
"headingTabindexAfterBlur": null,
|
||||
"state": "normal",
|
||||
"initialSafe": true,
|
||||
"nativeTabContained": true,
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"trigger": false,
|
||||
"heading": true,
|
||||
"inert": false,
|
||||
"bodyLocked": false,
|
||||
"headingTabindexAfterBlur": null,
|
||||
"state": "disabled",
|
||||
"initialSafe": true,
|
||||
"nativeTabContained": true,
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"trigger": false,
|
||||
"heading": true,
|
||||
"inert": false,
|
||||
"bodyLocked": false,
|
||||
"headingTabindexAfterBlur": null,
|
||||
"state": "hidden",
|
||||
"initialSafe": true,
|
||||
"nativeTabContained": true,
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"trigger": false,
|
||||
"heading": true,
|
||||
"inert": false,
|
||||
"bodyLocked": false,
|
||||
"headingTabindexAfterBlur": null,
|
||||
"state": "unfocusable",
|
||||
"initialSafe": true,
|
||||
"nativeTabContained": true,
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"trigger": false,
|
||||
"heading": true,
|
||||
"inert": false,
|
||||
"bodyLocked": false,
|
||||
"headingTabindexAfterBlur": null,
|
||||
"state": "disconnected",
|
||||
"initialSafe": true,
|
||||
"nativeTabContained": true,
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"trigger": false,
|
||||
"heading": true,
|
||||
"inert": false,
|
||||
"bodyLocked": false,
|
||||
"headingTabindexAfterBlur": "2",
|
||||
"state": "existing-heading-tabindex",
|
||||
"initialSafe": true,
|
||||
"nativeTabContained": true,
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"first": true,
|
||||
"second": false,
|
||||
"busyCalls": 0,
|
||||
"readyCalls": 1,
|
||||
"firstStillLocked": true,
|
||||
"restored": true,
|
||||
"state": "single-active-and-busy",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"tag": "H2",
|
||||
"insideClosingDialog": false,
|
||||
"text": "Stable page section",
|
||||
"state": "closing-heading-h2",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"tag": "MAIN",
|
||||
"insideClosingDialog": false,
|
||||
"text": "OpenNext",
|
||||
"state": "closing-heading-landmark",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"priorInert": true,
|
||||
"mainInert": false,
|
||||
"priorModalOpen": true,
|
||||
"trigger": true,
|
||||
"state": "restore-existing-inert-body",
|
||||
"passed": true
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1 @@
|
||||
{'cases': 10, 'passed': 10}
|
||||
@@ -0,0 +1,100 @@
|
||||
[
|
||||
{
|
||||
"trigger": true,
|
||||
"heading": false,
|
||||
"inert": false,
|
||||
"bodyLocked": false,
|
||||
"headingTabindexAfterBlur": null,
|
||||
"state": "normal",
|
||||
"initialSafe": true,
|
||||
"nativeTabContained": true,
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"trigger": false,
|
||||
"heading": true,
|
||||
"inert": false,
|
||||
"bodyLocked": false,
|
||||
"headingTabindexAfterBlur": null,
|
||||
"state": "disabled",
|
||||
"initialSafe": true,
|
||||
"nativeTabContained": true,
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"trigger": false,
|
||||
"heading": true,
|
||||
"inert": false,
|
||||
"bodyLocked": false,
|
||||
"headingTabindexAfterBlur": null,
|
||||
"state": "hidden",
|
||||
"initialSafe": true,
|
||||
"nativeTabContained": true,
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"trigger": false,
|
||||
"heading": true,
|
||||
"inert": false,
|
||||
"bodyLocked": false,
|
||||
"headingTabindexAfterBlur": null,
|
||||
"state": "unfocusable",
|
||||
"initialSafe": true,
|
||||
"nativeTabContained": true,
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"trigger": false,
|
||||
"heading": true,
|
||||
"inert": false,
|
||||
"bodyLocked": false,
|
||||
"headingTabindexAfterBlur": null,
|
||||
"state": "disconnected",
|
||||
"initialSafe": true,
|
||||
"nativeTabContained": true,
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"trigger": false,
|
||||
"heading": true,
|
||||
"inert": false,
|
||||
"bodyLocked": false,
|
||||
"headingTabindexAfterBlur": "2",
|
||||
"state": "existing-heading-tabindex",
|
||||
"initialSafe": true,
|
||||
"nativeTabContained": true,
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"first": true,
|
||||
"second": false,
|
||||
"busyCalls": 0,
|
||||
"readyCalls": 1,
|
||||
"firstStillLocked": true,
|
||||
"restored": true,
|
||||
"state": "single-active-and-busy",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"tag": "H2",
|
||||
"insideClosingDialog": false,
|
||||
"text": "Stable page section",
|
||||
"state": "closing-heading-h2",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"tag": "MAIN",
|
||||
"insideClosingDialog": false,
|
||||
"text": "OpenNext",
|
||||
"state": "closing-heading-landmark",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"priorInert": true,
|
||||
"mainInert": false,
|
||||
"priorModalOpen": true,
|
||||
"trigger": true,
|
||||
"state": "restore-existing-inert-body",
|
||||
"passed": true
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1 @@
|
||||
{'cases': 10, 'passed': 10}
|
||||
@@ -0,0 +1,320 @@
|
||||
{
|
||||
"boundary": "Production JS; real native DOM focus, inert, Tab/Shift+Tab/Escape; synthetic recording receiver; no network/host",
|
||||
"scenes": [
|
||||
{
|
||||
"case": "busy-update",
|
||||
"beforeUpdate": "BODY",
|
||||
"checks": [
|
||||
{
|
||||
"name": "Safe initial Cancel focus",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Busy update reanchors native disabled-control focus",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Busy native Tab remains scoped with no usable controls",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Busy native Tab remains scoped with no usable controls",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Busy native Tab remains scoped with no usable controls",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Busy reverse Tab remains scoped",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Body-gap Escape precedes ancestor shortcuts",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Busy Escape dispatches no close",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Busy Escape does not reach background shortcuts",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Idle controls remain reachable after recovery",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Idle Escape invokes current close once",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "No page errors",
|
||||
"passed": true
|
||||
}
|
||||
],
|
||||
"errors": [],
|
||||
"calls": [
|
||||
{
|
||||
"name": "RequestCloseFromDom",
|
||||
"generation": 1
|
||||
}
|
||||
],
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"case": "removed-control",
|
||||
"beforeUpdate": "removed Save",
|
||||
"checks": [
|
||||
{
|
||||
"name": "Safe initial Cancel focus",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Removal update restores safe current focus",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Escape works after focused control removal",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "No page errors",
|
||||
"passed": true
|
||||
}
|
||||
],
|
||||
"errors": [],
|
||||
"calls": [
|
||||
{
|
||||
"name": "RequestCloseFromDom",
|
||||
"generation": 1
|
||||
}
|
||||
],
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"case": "document-key-gap",
|
||||
"beforeUpdate": "BODY",
|
||||
"checks": [
|
||||
{
|
||||
"name": "Safe initial Cancel focus",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Busy native Tab remains scoped with no usable controls",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Busy native Tab remains scoped with no usable controls",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Busy native Tab remains scoped with no usable controls",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Busy reverse Tab remains scoped",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Body-gap Escape precedes ancestor shortcuts",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Busy Escape dispatches no close",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Busy Escape does not reach background shortcuts",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Idle controls remain reachable after recovery",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Idle Escape invokes current close once",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "No page errors",
|
||||
"passed": true
|
||||
}
|
||||
],
|
||||
"errors": [],
|
||||
"calls": [
|
||||
{
|
||||
"name": "RequestCloseFromDom",
|
||||
"generation": 1
|
||||
}
|
||||
],
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"case": "stale-generation",
|
||||
"beforeUpdate": "generation2",
|
||||
"checks": [
|
||||
{
|
||||
"name": "Safe initial Cancel focus",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Stale update/deactivate cannot change current focus",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Stale update cannot mark new dialog busy",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "No page errors",
|
||||
"passed": true
|
||||
}
|
||||
],
|
||||
"errors": [],
|
||||
"calls": [
|
||||
{
|
||||
"name": "RequestCloseFromDom",
|
||||
"generation": 2
|
||||
}
|
||||
],
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"case": "other-dialog-intent",
|
||||
"beforeUpdate": "other dialog",
|
||||
"checks": [
|
||||
{
|
||||
"name": "Safe initial Cancel focus",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Update does not steal deliberate other-dialog focus",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Other dialog Escape is not intercepted",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "No page errors",
|
||||
"passed": true
|
||||
}
|
||||
],
|
||||
"errors": [],
|
||||
"calls": [],
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"case": "idle-read",
|
||||
"beforeUpdate": "aria-disabled read",
|
||||
"checks": [
|
||||
{
|
||||
"name": "Safe initial Cancel focus",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Read-only pending control retains focus",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Dismissible read Escape survives body-focus gap",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Idle body-gap Escape precedes ancestor shortcuts",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "No page errors",
|
||||
"passed": true
|
||||
}
|
||||
],
|
||||
"errors": [],
|
||||
"calls": [
|
||||
{
|
||||
"name": "RequestCloseFromDom",
|
||||
"generation": 1
|
||||
}
|
||||
],
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"case": "child-handled-escape",
|
||||
"beforeUpdate": "child handled Escape",
|
||||
"checks": [
|
||||
{
|
||||
"name": "Safe initial Cancel focus",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Child widget retains handled Escape",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Child focus remains deliberate",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "No page errors",
|
||||
"passed": true
|
||||
}
|
||||
],
|
||||
"errors": [],
|
||||
"calls": [],
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"case": "deactivated-cleanup",
|
||||
"beforeUpdate": "deactivated",
|
||||
"checks": [
|
||||
{
|
||||
"name": "Safe initial Cancel focus",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Deactivation removes document key interception",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Existing inert/body state is restored",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "No page errors",
|
||||
"passed": true
|
||||
}
|
||||
],
|
||||
"errors": [],
|
||||
"calls": [],
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"case": "ancestor-shortcut",
|
||||
"beforeUpdate": "local ancestor shortcut",
|
||||
"checks": [
|
||||
{
|
||||
"name": "Safe initial Cancel focus",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Local Escape remains ahead of ancestor shortcuts",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "No page errors",
|
||||
"passed": true
|
||||
}
|
||||
],
|
||||
"errors": [],
|
||||
"calls": [
|
||||
{
|
||||
"name": "RequestCloseFromDom",
|
||||
"generation": 1
|
||||
}
|
||||
],
|
||||
"passed": true
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{"scenes": 9, "passed": 9, "checks": 51}
|
||||
@@ -0,0 +1,232 @@
|
||||
{
|
||||
"boundary": "Production JS; real native DOM focus, inert, Tab/Shift+Tab/Escape; synthetic recording receiver; no network/host",
|
||||
"scenes": [
|
||||
{
|
||||
"case": "busy-update",
|
||||
"beforeUpdate": "BODY",
|
||||
"checks": [
|
||||
{
|
||||
"name": "Safe initial Cancel focus",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Busy update reanchors native disabled-control focus",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Busy native Tab remains scoped with no usable controls",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Busy native Tab remains scoped with no usable controls",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Busy native Tab remains scoped with no usable controls",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Busy reverse Tab remains scoped",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Busy Escape dispatches no close",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Busy Escape does not reach background shortcuts",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Idle controls remain reachable after recovery",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Idle Escape invokes current close once",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "No page errors",
|
||||
"passed": true
|
||||
}
|
||||
],
|
||||
"errors": [],
|
||||
"calls": [
|
||||
{
|
||||
"name": "RequestCloseFromDom",
|
||||
"generation": 1
|
||||
}
|
||||
],
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"case": "removed-control",
|
||||
"beforeUpdate": "removed Save",
|
||||
"checks": [
|
||||
{
|
||||
"name": "Safe initial Cancel focus",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Removal update restores safe current focus",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Escape works after focused control removal",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "No page errors",
|
||||
"passed": true
|
||||
}
|
||||
],
|
||||
"errors": [],
|
||||
"calls": [
|
||||
{
|
||||
"name": "RequestCloseFromDom",
|
||||
"generation": 1
|
||||
}
|
||||
],
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"case": "document-key-gap",
|
||||
"beforeUpdate": "BODY",
|
||||
"checks": [
|
||||
{
|
||||
"name": "Safe initial Cancel focus",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Busy native Tab remains scoped with no usable controls",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Busy native Tab remains scoped with no usable controls",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Busy native Tab remains scoped with no usable controls",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Busy reverse Tab remains scoped",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Busy Escape dispatches no close",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Busy Escape does not reach background shortcuts",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Idle controls remain reachable after recovery",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Idle Escape invokes current close once",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "No page errors",
|
||||
"passed": true
|
||||
}
|
||||
],
|
||||
"errors": [],
|
||||
"calls": [
|
||||
{
|
||||
"name": "RequestCloseFromDom",
|
||||
"generation": 1
|
||||
}
|
||||
],
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"case": "stale-generation",
|
||||
"beforeUpdate": "generation2",
|
||||
"checks": [
|
||||
{
|
||||
"name": "Safe initial Cancel focus",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Stale update/deactivate cannot change current focus",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Stale update cannot mark new dialog busy",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "No page errors",
|
||||
"passed": true
|
||||
}
|
||||
],
|
||||
"errors": [],
|
||||
"calls": [
|
||||
{
|
||||
"name": "RequestCloseFromDom",
|
||||
"generation": 2
|
||||
}
|
||||
],
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"case": "other-dialog-intent",
|
||||
"beforeUpdate": "other dialog",
|
||||
"checks": [
|
||||
{
|
||||
"name": "Safe initial Cancel focus",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Update does not steal deliberate other-dialog focus",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Other dialog Escape is not intercepted",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "No page errors",
|
||||
"passed": true
|
||||
}
|
||||
],
|
||||
"errors": [],
|
||||
"calls": [],
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"case": "idle-read",
|
||||
"beforeUpdate": "aria-disabled read",
|
||||
"checks": [
|
||||
{
|
||||
"name": "Safe initial Cancel focus",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Read-only pending control retains focus",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Dismissible read Escape survives body-focus gap",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "No page errors",
|
||||
"passed": true
|
||||
}
|
||||
],
|
||||
"errors": [],
|
||||
"calls": [
|
||||
{
|
||||
"name": "RequestCloseFromDom",
|
||||
"generation": 1
|
||||
}
|
||||
],
|
||||
"passed": true
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{"scenes": 6, "passed": 6, "checks": 37}
|
||||
@@ -0,0 +1,320 @@
|
||||
{
|
||||
"boundary": "Production JS; real native DOM focus, inert, Tab/Shift+Tab/Escape; synthetic recording receiver; no network/host",
|
||||
"scenes": [
|
||||
{
|
||||
"case": "busy-update",
|
||||
"beforeUpdate": "BODY",
|
||||
"checks": [
|
||||
{
|
||||
"name": "Safe initial Cancel focus",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Busy update reanchors native disabled-control focus",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Busy native Tab remains scoped with no usable controls",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Busy native Tab remains scoped with no usable controls",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Busy native Tab remains scoped with no usable controls",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Busy reverse Tab remains scoped",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Body-gap Escape precedes ancestor shortcuts",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Busy Escape dispatches no close",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Busy Escape does not reach background shortcuts",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Idle controls remain reachable after recovery",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Idle Escape invokes current close once",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "No page errors",
|
||||
"passed": true
|
||||
}
|
||||
],
|
||||
"errors": [],
|
||||
"calls": [
|
||||
{
|
||||
"name": "RequestCloseFromDom",
|
||||
"generation": 1
|
||||
}
|
||||
],
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"case": "removed-control",
|
||||
"beforeUpdate": "removed Save",
|
||||
"checks": [
|
||||
{
|
||||
"name": "Safe initial Cancel focus",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Removal update restores safe current focus",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Escape works after focused control removal",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "No page errors",
|
||||
"passed": true
|
||||
}
|
||||
],
|
||||
"errors": [],
|
||||
"calls": [
|
||||
{
|
||||
"name": "RequestCloseFromDom",
|
||||
"generation": 1
|
||||
}
|
||||
],
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"case": "document-key-gap",
|
||||
"beforeUpdate": "BODY",
|
||||
"checks": [
|
||||
{
|
||||
"name": "Safe initial Cancel focus",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Busy native Tab remains scoped with no usable controls",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Busy native Tab remains scoped with no usable controls",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Busy native Tab remains scoped with no usable controls",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Busy reverse Tab remains scoped",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Body-gap Escape precedes ancestor shortcuts",
|
||||
"passed": false
|
||||
},
|
||||
{
|
||||
"name": "Busy Escape dispatches no close",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Busy Escape does not reach background shortcuts",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Idle controls remain reachable after recovery",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Idle Escape invokes current close once",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "No page errors",
|
||||
"passed": true
|
||||
}
|
||||
],
|
||||
"errors": [],
|
||||
"calls": [
|
||||
{
|
||||
"name": "RequestCloseFromDom",
|
||||
"generation": 1
|
||||
}
|
||||
],
|
||||
"passed": false
|
||||
},
|
||||
{
|
||||
"case": "stale-generation",
|
||||
"beforeUpdate": "generation2",
|
||||
"checks": [
|
||||
{
|
||||
"name": "Safe initial Cancel focus",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Stale update/deactivate cannot change current focus",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Stale update cannot mark new dialog busy",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "No page errors",
|
||||
"passed": true
|
||||
}
|
||||
],
|
||||
"errors": [],
|
||||
"calls": [
|
||||
{
|
||||
"name": "RequestCloseFromDom",
|
||||
"generation": 2
|
||||
}
|
||||
],
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"case": "other-dialog-intent",
|
||||
"beforeUpdate": "other dialog",
|
||||
"checks": [
|
||||
{
|
||||
"name": "Safe initial Cancel focus",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Update does not steal deliberate other-dialog focus",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Other dialog Escape is not intercepted",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "No page errors",
|
||||
"passed": true
|
||||
}
|
||||
],
|
||||
"errors": [],
|
||||
"calls": [],
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"case": "idle-read",
|
||||
"beforeUpdate": "aria-disabled read",
|
||||
"checks": [
|
||||
{
|
||||
"name": "Safe initial Cancel focus",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Read-only pending control retains focus",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Dismissible read Escape survives body-focus gap",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Idle body-gap Escape precedes ancestor shortcuts",
|
||||
"passed": false
|
||||
},
|
||||
{
|
||||
"name": "No page errors",
|
||||
"passed": true
|
||||
}
|
||||
],
|
||||
"errors": [],
|
||||
"calls": [
|
||||
{
|
||||
"name": "RequestCloseFromDom",
|
||||
"generation": 1
|
||||
}
|
||||
],
|
||||
"passed": false
|
||||
},
|
||||
{
|
||||
"case": "child-handled-escape",
|
||||
"beforeUpdate": "child handled Escape",
|
||||
"checks": [
|
||||
{
|
||||
"name": "Safe initial Cancel focus",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Child widget retains handled Escape",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Child focus remains deliberate",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "No page errors",
|
||||
"passed": true
|
||||
}
|
||||
],
|
||||
"errors": [],
|
||||
"calls": [],
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"case": "deactivated-cleanup",
|
||||
"beforeUpdate": "deactivated",
|
||||
"checks": [
|
||||
{
|
||||
"name": "Safe initial Cancel focus",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Deactivation removes document key interception",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Existing inert/body state is restored",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "No page errors",
|
||||
"passed": true
|
||||
}
|
||||
],
|
||||
"errors": [],
|
||||
"calls": [],
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"case": "ancestor-shortcut",
|
||||
"beforeUpdate": "local ancestor shortcut",
|
||||
"checks": [
|
||||
{
|
||||
"name": "Safe initial Cancel focus",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Local Escape remains ahead of ancestor shortcuts",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "No page errors",
|
||||
"passed": true
|
||||
}
|
||||
],
|
||||
"errors": [],
|
||||
"calls": [
|
||||
{
|
||||
"name": "RequestCloseFromDom",
|
||||
"generation": 1
|
||||
}
|
||||
],
|
||||
"passed": true
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{"scenes": 9, "passed": 7, "checks": 51}
|
||||
@@ -0,0 +1,222 @@
|
||||
{
|
||||
"boundary": "Production JS; real native DOM focus, inert, Tab/Shift+Tab/Escape; synthetic recording receiver; no network/host",
|
||||
"scenes": [
|
||||
{
|
||||
"case": "busy-update",
|
||||
"beforeUpdate": "BODY",
|
||||
"checks": [
|
||||
{
|
||||
"name": "Safe initial Cancel focus",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Busy update reanchors native disabled-control focus",
|
||||
"passed": false
|
||||
},
|
||||
{
|
||||
"name": "Busy native Tab remains scoped with no usable controls",
|
||||
"passed": false
|
||||
},
|
||||
{
|
||||
"name": "Busy native Tab remains scoped with no usable controls",
|
||||
"passed": false
|
||||
},
|
||||
{
|
||||
"name": "Busy native Tab remains scoped with no usable controls",
|
||||
"passed": false
|
||||
},
|
||||
{
|
||||
"name": "Busy reverse Tab remains scoped",
|
||||
"passed": false
|
||||
},
|
||||
{
|
||||
"name": "Busy Escape dispatches no close",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Busy Escape does not reach background shortcuts",
|
||||
"passed": false
|
||||
},
|
||||
{
|
||||
"name": "Idle controls remain reachable after recovery",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Idle Escape invokes current close once",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "No page errors",
|
||||
"passed": true
|
||||
}
|
||||
],
|
||||
"errors": [],
|
||||
"calls": [
|
||||
{
|
||||
"name": "RequestCloseFromDom",
|
||||
"generation": 1
|
||||
}
|
||||
],
|
||||
"passed": false
|
||||
},
|
||||
{
|
||||
"case": "removed-control",
|
||||
"beforeUpdate": "removed Save",
|
||||
"checks": [
|
||||
{
|
||||
"name": "Safe initial Cancel focus",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Removal update restores safe current focus",
|
||||
"passed": false
|
||||
},
|
||||
{
|
||||
"name": "Escape works after focused control removal",
|
||||
"passed": false
|
||||
},
|
||||
{
|
||||
"name": "No page errors",
|
||||
"passed": true
|
||||
}
|
||||
],
|
||||
"errors": [],
|
||||
"calls": [],
|
||||
"passed": false
|
||||
},
|
||||
{
|
||||
"case": "document-key-gap",
|
||||
"beforeUpdate": "BODY",
|
||||
"checks": [
|
||||
{
|
||||
"name": "Safe initial Cancel focus",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Busy native Tab remains scoped with no usable controls",
|
||||
"passed": false
|
||||
},
|
||||
{
|
||||
"name": "Busy native Tab remains scoped with no usable controls",
|
||||
"passed": false
|
||||
},
|
||||
{
|
||||
"name": "Busy native Tab remains scoped with no usable controls",
|
||||
"passed": false
|
||||
},
|
||||
{
|
||||
"name": "Busy reverse Tab remains scoped",
|
||||
"passed": false
|
||||
},
|
||||
{
|
||||
"name": "Busy Escape dispatches no close",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Busy Escape does not reach background shortcuts",
|
||||
"passed": false
|
||||
},
|
||||
{
|
||||
"name": "Idle controls remain reachable after recovery",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Idle Escape invokes current close once",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "No page errors",
|
||||
"passed": true
|
||||
}
|
||||
],
|
||||
"errors": [],
|
||||
"calls": [
|
||||
{
|
||||
"name": "RequestCloseFromDom",
|
||||
"generation": 1
|
||||
}
|
||||
],
|
||||
"passed": false
|
||||
},
|
||||
{
|
||||
"case": "stale-generation",
|
||||
"beforeUpdate": "generation2",
|
||||
"checks": [
|
||||
{
|
||||
"name": "Safe initial Cancel focus",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Stale update/deactivate cannot change current focus",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Stale update cannot mark new dialog busy",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "No page errors",
|
||||
"passed": true
|
||||
}
|
||||
],
|
||||
"errors": [],
|
||||
"calls": [
|
||||
{
|
||||
"name": "RequestCloseFromDom",
|
||||
"generation": 2
|
||||
}
|
||||
],
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"case": "other-dialog-intent",
|
||||
"beforeUpdate": "other dialog",
|
||||
"checks": [
|
||||
{
|
||||
"name": "Safe initial Cancel focus",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Update does not steal deliberate other-dialog focus",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Other dialog Escape is not intercepted",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "No page errors",
|
||||
"passed": true
|
||||
}
|
||||
],
|
||||
"errors": [],
|
||||
"calls": [],
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"case": "idle-read",
|
||||
"beforeUpdate": "aria-disabled read",
|
||||
"checks": [
|
||||
{
|
||||
"name": "Safe initial Cancel focus",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Read-only pending control retains focus",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Dismissible read Escape survives body-focus gap",
|
||||
"passed": false
|
||||
},
|
||||
{
|
||||
"name": "No page errors",
|
||||
"passed": true
|
||||
}
|
||||
],
|
||||
"errors": [],
|
||||
"calls": [],
|
||||
"passed": false
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{"scenes": 6, "passed": 2, "checks": 37}
|
||||
@@ -0,0 +1,214 @@
|
||||
{
|
||||
"boundary": "Production JS; real native DOM focus, inert, Tab/Shift+Tab/Escape; synthetic recording receiver; no network/host",
|
||||
"scenes": [
|
||||
{
|
||||
"case": "busy-update",
|
||||
"beforeUpdate": "BODY",
|
||||
"checks": [
|
||||
{
|
||||
"name": "Safe initial Cancel focus",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Busy update reanchors native disabled-control focus",
|
||||
"passed": false
|
||||
},
|
||||
{
|
||||
"name": "Busy native Tab remains scoped with no usable controls",
|
||||
"passed": false
|
||||
},
|
||||
{
|
||||
"name": "Busy native Tab remains scoped with no usable controls",
|
||||
"passed": false
|
||||
},
|
||||
{
|
||||
"name": "Busy native Tab remains scoped with no usable controls",
|
||||
"passed": false
|
||||
},
|
||||
{
|
||||
"name": "Busy reverse Tab remains scoped",
|
||||
"passed": false
|
||||
},
|
||||
{
|
||||
"name": "Busy Escape dispatches no close",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Idle controls remain reachable after recovery",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Idle Escape invokes current close once",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "No page errors",
|
||||
"passed": true
|
||||
}
|
||||
],
|
||||
"errors": [],
|
||||
"calls": [
|
||||
{
|
||||
"name": "RequestCloseFromDom",
|
||||
"generation": 1
|
||||
}
|
||||
],
|
||||
"passed": false
|
||||
},
|
||||
{
|
||||
"case": "removed-control",
|
||||
"beforeUpdate": "removed Save",
|
||||
"checks": [
|
||||
{
|
||||
"name": "Safe initial Cancel focus",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Removal update restores safe current focus",
|
||||
"passed": false
|
||||
},
|
||||
{
|
||||
"name": "Escape works after focused control removal",
|
||||
"passed": false
|
||||
},
|
||||
{
|
||||
"name": "No page errors",
|
||||
"passed": true
|
||||
}
|
||||
],
|
||||
"errors": [],
|
||||
"calls": [],
|
||||
"passed": false
|
||||
},
|
||||
{
|
||||
"case": "document-key-gap",
|
||||
"beforeUpdate": "BODY",
|
||||
"checks": [
|
||||
{
|
||||
"name": "Safe initial Cancel focus",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Busy native Tab remains scoped with no usable controls",
|
||||
"passed": false
|
||||
},
|
||||
{
|
||||
"name": "Busy native Tab remains scoped with no usable controls",
|
||||
"passed": false
|
||||
},
|
||||
{
|
||||
"name": "Busy native Tab remains scoped with no usable controls",
|
||||
"passed": false
|
||||
},
|
||||
{
|
||||
"name": "Busy reverse Tab remains scoped",
|
||||
"passed": false
|
||||
},
|
||||
{
|
||||
"name": "Busy Escape dispatches no close",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Idle controls remain reachable after recovery",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Idle Escape invokes current close once",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "No page errors",
|
||||
"passed": true
|
||||
}
|
||||
],
|
||||
"errors": [],
|
||||
"calls": [
|
||||
{
|
||||
"name": "RequestCloseFromDom",
|
||||
"generation": 1
|
||||
}
|
||||
],
|
||||
"passed": false
|
||||
},
|
||||
{
|
||||
"case": "stale-generation",
|
||||
"beforeUpdate": "generation2",
|
||||
"checks": [
|
||||
{
|
||||
"name": "Safe initial Cancel focus",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Stale update/deactivate cannot change current focus",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Stale update cannot mark new dialog busy",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "No page errors",
|
||||
"passed": true
|
||||
}
|
||||
],
|
||||
"errors": [],
|
||||
"calls": [
|
||||
{
|
||||
"name": "RequestCloseFromDom",
|
||||
"generation": 2
|
||||
}
|
||||
],
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"case": "other-dialog-intent",
|
||||
"beforeUpdate": "other dialog",
|
||||
"checks": [
|
||||
{
|
||||
"name": "Safe initial Cancel focus",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Update does not steal deliberate other-dialog focus",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Other dialog Escape is not intercepted",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "No page errors",
|
||||
"passed": true
|
||||
}
|
||||
],
|
||||
"errors": [],
|
||||
"calls": [],
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"case": "idle-read",
|
||||
"beforeUpdate": "aria-disabled read",
|
||||
"checks": [
|
||||
{
|
||||
"name": "Safe initial Cancel focus",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Read-only pending control retains focus",
|
||||
"passed": true
|
||||
},
|
||||
{
|
||||
"name": "Dismissible read Escape survives body-focus gap",
|
||||
"passed": false
|
||||
},
|
||||
{
|
||||
"name": "No page errors",
|
||||
"passed": true
|
||||
}
|
||||
],
|
||||
"errors": [],
|
||||
"calls": [],
|
||||
"passed": false
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{"scenes": 6, "passed": 2, "checks": 35}
|
||||
@@ -0,0 +1,77 @@
|
||||
"""Native Chromium focus regression against actual production dialog-focus.js.
|
||||
|
||||
Uses a local synthetic document and recording receiver only; no application server,
|
||||
network, database, operational service or package dependency is required.
|
||||
"""
|
||||
import argparse,json
|
||||
from pathlib import Path
|
||||
from playwright.sync_api import sync_playwright
|
||||
parser=argparse.ArgumentParser();parser.add_argument('--output',type=Path,required=True);args=parser.parse_args()
|
||||
source=Path(__file__).resolve().parents[3]/'src/Server/ZB.MOM.WW.OtOpcUa.AdminUI/wwwroot/js/dialog-focus.js'
|
||||
html='''<main><h1 tabindex="-1">Synthetic native focus fixture</h1><button id="trigger">Open synthetic dialog</button><button id="outside">Outside control</button></main>
|
||||
<div id="modal" role="dialog" aria-modal="true" tabindex="-1"><button id="header">Close dialog</button><fieldset id="fields"><input id="input" aria-label="Synthetic name"><button id="save">Save</button><button id="cancel" data-initial-focus>Cancel</button></fieldset></div>'''
|
||||
results=[]
|
||||
with sync_playwright() as p:
|
||||
browser=p.chromium.launch()
|
||||
for case in ['busy-update','removed-control','document-key-gap','stale-generation','other-dialog-intent','idle-read','child-handled-escape','deactivated-cleanup','ancestor-shortcut']:
|
||||
page=browser.new_page();errors=[];page.on('pageerror',lambda error:errors.append(str(error)));page.set_content(html);page.add_script_tag(content=source.read_text())
|
||||
page.evaluate("window.calls=[];window.bodyEscapes=0;document.body.addEventListener('keydown',e=>{if(e.key==='Escape')bodyEscapes++;});window.leakedEscapes=0;window.addEventListener('keydown',e=>{if(e.key==='Escape')leakedEscapes++;});window.receiver={invokeMethodAsync:(name,generation)=>{calls.push({name,generation});return Promise.resolve();}};document.getElementById('trigger').focus();otDialog.activate('modal',receiver,1,false)")
|
||||
checks=[]
|
||||
def check(name,value):checks.append({'name':name,'passed':bool(value)})
|
||||
within=lambda:page.locator('#modal').evaluate('el=>el.contains(document.activeElement)')
|
||||
check('Safe initial Cancel focus',page.locator('#cancel').evaluate('n=>n===document.activeElement'))
|
||||
if case in ['busy-update','document-key-gap']:
|
||||
page.locator('#save').focus();page.evaluate("document.getElementById('fields').disabled=true;document.getElementById('header').disabled=true")
|
||||
before=page.evaluate('document.activeElement.tagName')
|
||||
page.evaluate("otDialog.update('modal',1,true)")
|
||||
if case=='busy-update':check('Busy update reanchors native disabled-control focus',within())
|
||||
else:page.evaluate('document.activeElement.blur()')
|
||||
for _ in range(3):page.keyboard.press('Tab');check('Busy native Tab remains scoped with no usable controls',within())
|
||||
page.keyboard.press('Shift+Tab');check('Busy reverse Tab remains scoped',within())
|
||||
if case=='document-key-gap':page.evaluate('document.activeElement.blur()')
|
||||
page.keyboard.press('Escape');check('Body-gap Escape precedes ancestor shortcuts',page.evaluate('bodyEscapes')==0);check('Busy Escape dispatches no close',page.evaluate('calls.length')==0);check('Busy Escape does not reach background shortcuts',page.evaluate('leakedEscapes')==0)
|
||||
page.evaluate("document.getElementById('fields').disabled=false;document.getElementById('header').disabled=false;otDialog.update('modal',1,false)")
|
||||
page.keyboard.press('Tab');check('Idle controls remain reachable after recovery',within())
|
||||
page.keyboard.press('Escape');check('Idle Escape invokes current close once',page.evaluate('calls')==[{'name':'RequestCloseFromDom','generation':1}])
|
||||
elif case=='removed-control':
|
||||
page.locator('#save').focus();page.evaluate("document.getElementById('save').remove();otDialog.update('modal',1,false)")
|
||||
check('Removal update restores safe current focus',page.locator('#cancel').evaluate('n=>n===document.activeElement'))
|
||||
page.keyboard.press('Escape');check('Escape works after focused control removal',page.evaluate('calls.length')==1)
|
||||
before='removed Save'
|
||||
elif case=='stale-generation':
|
||||
page.evaluate("otDialog.deactivate('modal',1);otDialog.activate('modal',receiver,2,false);document.getElementById('input').focus();otDialog.update('modal',1,true);otDialog.deactivate('modal',1)")
|
||||
check('Stale update/deactivate cannot change current focus',page.locator('#input').evaluate('n=>n===document.activeElement'))
|
||||
page.keyboard.press('Escape');check('Stale update cannot mark new dialog busy',page.evaluate('calls')==[{'name':'RequestCloseFromDom','generation':2}])
|
||||
before='generation2'
|
||||
elif case=='other-dialog-intent':
|
||||
page.evaluate("const other=document.createElement('div');other.setAttribute('role','dialog');other.innerHTML='<button id=other>Other modal control</button>';document.body.append(other);document.getElementById('other').focus();otDialog.update('modal',1,true)")
|
||||
check('Update does not steal deliberate other-dialog focus',page.locator('#other').evaluate('n=>n===document.activeElement'))
|
||||
page.keyboard.press('Escape');check('Other dialog Escape is not intercepted',page.evaluate('calls.length')==0)
|
||||
before='other dialog'
|
||||
elif case=='child-handled-escape':
|
||||
page.locator('#input').focus();page.locator('#input').evaluate("n=>n.addEventListener('keydown',e=>{if(e.key==='Escape')e.stopPropagation();})")
|
||||
page.keyboard.press('Escape');check('Child widget retains handled Escape',page.evaluate('calls.length')==0 and page.evaluate('leakedEscapes')==0)
|
||||
check('Child focus remains deliberate',page.locator('#input').evaluate('n=>n===document.activeElement'))
|
||||
before='child handled Escape'
|
||||
elif case=='ancestor-shortcut':
|
||||
page.evaluate("window.ancestorEscapes=0;document.body.addEventListener('keydown',e=>{if(e.key==='Escape')ancestorEscapes++;})")
|
||||
page.locator('#input').focus();page.keyboard.press('Escape')
|
||||
check('Local Escape remains ahead of ancestor shortcuts',page.evaluate('ancestorEscapes')==0 and page.evaluate('calls.length')==1)
|
||||
before='local ancestor shortcut'
|
||||
elif case=='deactivated-cleanup':
|
||||
page.evaluate("otDialog.deactivate('modal',1)");page.locator('#outside').focus();page.keyboard.press('Escape')
|
||||
check('Deactivation removes document key interception',page.evaluate('calls.length')==0 and page.evaluate('leakedEscapes')==1)
|
||||
check('Existing inert/body state is restored',page.evaluate("!document.querySelector('main').inert&&!document.body.classList.contains('modal-open')"))
|
||||
before='deactivated'
|
||||
else:
|
||||
page.locator('#save').focus();page.locator('#save').evaluate("n=>n.setAttribute('aria-disabled','true')");page.evaluate("otDialog.update('modal',1,false)")
|
||||
check('Read-only pending control retains focus',page.locator('#save').evaluate('n=>n===document.activeElement'))
|
||||
page.evaluate('document.activeElement.blur()');page.keyboard.press('Escape');check('Dismissible read Escape survives body-focus gap',page.evaluate('calls')==[{'name':'RequestCloseFromDom','generation':1}])
|
||||
check('Idle body-gap Escape precedes ancestor shortcuts',page.evaluate('bodyEscapes')==0)
|
||||
before='aria-disabled read'
|
||||
check('No page errors',not errors)
|
||||
results.append({'case':case,'beforeUpdate':before,'checks':checks,'errors':errors,'calls':page.evaluate('calls'),'passed':all(c['passed']for c in checks)})
|
||||
page.close()
|
||||
browser.close()
|
||||
args.output.parent.mkdir(parents=True,exist_ok=True);args.output.write_text(json.dumps({'boundary':'Production JS; real native DOM focus, inert, Tab/Shift+Tab/Escape; synthetic recording receiver; no network/host', 'scenes':results},indent=2)+'\n')
|
||||
print(json.dumps({'scenes':len(results),'passed':sum(s['passed']for s in results),'checks':sum(len(s['checks'])for s in results)}));raise SystemExit(0 if all(s['passed']for s in results)else 1)
|
||||
@@ -9,6 +9,18 @@
|
||||
!el.matches(':disabled') && !el.closest('[inert],[hidden]') &&
|
||||
el.getClientRects().length && getComputedStyle(el).visibility !== 'hidden');
|
||||
}
|
||||
function otherDialogHasFocus(state) {
|
||||
const owner = document.activeElement?.closest('[role="dialog"],dialog');
|
||||
return owner && owner !== state.el && !state.el.contains(owner);
|
||||
}
|
||||
function anchorFocus(state) {
|
||||
if (current !== state || !state.el.isConnected || state.el.closest('[inert]') ||
|
||||
state.el.contains(document.activeElement) || otherDialogHasFocus(state)) return;
|
||||
// Disabling/removing the focused control can leave focus on body. Keep the
|
||||
// current presentation reachable even when every busy action is disabled.
|
||||
const safe = focusable(state.el).find(item => item.matches('[data-initial-focus]'));
|
||||
(safe || state.el).focus();
|
||||
}
|
||||
function restoreFocus(trigger) {
|
||||
if (trigger?.isConnected && !trigger.closest('[inert]')) trigger.focus();
|
||||
if (document.activeElement === trigger) return;
|
||||
@@ -28,6 +40,7 @@
|
||||
if (!current || current.id !== id || (generation !== undefined && current.generation !== generation)) return;
|
||||
const state = current; current = null;
|
||||
state.el.removeEventListener('keydown', state.keydown);
|
||||
document.removeEventListener('keydown', state.keydown, true);
|
||||
state.locked.forEach(entry => entry.el.inert = entry.previous);
|
||||
if (!state.hadModalOpen) document.body.classList.remove('modal-open');
|
||||
restoreFocus(state.trigger);
|
||||
@@ -48,7 +61,8 @@
|
||||
if (node.parentElement === document.body) break;
|
||||
}
|
||||
state.keydown = event => {
|
||||
if (current !== state) return;
|
||||
if (current !== state || otherDialogHasFocus(state) ||
|
||||
(event.currentTarget === document && el.contains(event.target))) return;
|
||||
if (event.key === 'Escape') {
|
||||
event.preventDefault(); event.stopPropagation();
|
||||
if (!state.busy) state.receiver.invokeMethodAsync('RequestCloseFromDom', state.generation).catch(() => {});
|
||||
@@ -60,13 +74,20 @@
|
||||
else if (event.shiftKey && (active === first || !items.includes(active))) { event.preventDefault(); last.focus(); }
|
||||
else if (!event.shiftKey && (active === last || !items.includes(active))) { event.preventDefault(); first.focus(); }
|
||||
};
|
||||
// Capture only outside-target gaps before background shortcuts. Inside events
|
||||
// stay with the existing local listener and child-widget Escape handling.
|
||||
current = state; el.addEventListener('keydown', state.keydown);
|
||||
document.addEventListener('keydown', state.keydown, true);
|
||||
document.body.classList.add('modal-open');
|
||||
const initial = focusable(el).find(item => item.matches('[data-initial-focus]'));
|
||||
(initial || el).focus();
|
||||
return true;
|
||||
}
|
||||
function update(id, generation, busy) { if (current?.id === id && current.generation === generation) current.busy = busy; }
|
||||
function update(id, generation, busy) {
|
||||
if (current?.id !== id || current.generation !== generation) return;
|
||||
current.busy = busy;
|
||||
anchorFocus(current);
|
||||
}
|
||||
new MutationObserver(() => { if (current && !current.el.isConnected) deactivate(current.id); })
|
||||
.observe(document.documentElement, { childList: true, subtree: true });
|
||||
window.otDialog = { activate, update, deactivate };
|
||||
|
||||
Reference in New Issue
Block a user