fix(dashboard): pilot native dialog focus and safe dismissal

This commit is contained in:
Joseph Doherty
2026-11-13 17:51:02 -05:00
parent 3e004708d4
commit 260d58afa1
32 changed files with 1750 additions and 40 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 85 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 94 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

@@ -0,0 +1,531 @@
{
"cases": [
{
"width": 1440,
"dpr": 1,
"scroll": 1440,
"zoom": 1,
"nativeModal": true,
"outsideFocusBlocked": true,
"focusSamples": [
{
"inside": true,
"tag": "INPUT",
"id": "displayName",
"documentHasFocus": true
},
{
"inside": true,
"tag": "INPUT",
"id": "",
"documentHasFocus": true
},
{
"inside": true,
"tag": "INPUT",
"id": "",
"documentHasFocus": true
},
{
"inside": true,
"tag": "INPUT",
"id": "",
"documentHasFocus": true
},
{
"inside": true,
"tag": "INPUT",
"id": "",
"documentHasFocus": true
},
{
"inside": true,
"tag": "INPUT",
"id": "",
"documentHasFocus": true
},
{
"inside": true,
"tag": "INPUT",
"id": "",
"documentHasFocus": true
},
{
"inside": true,
"tag": "INPUT",
"id": "",
"documentHasFocus": true
},
{
"inside": true,
"tag": "INPUT",
"id": "",
"documentHasFocus": true
},
{
"inside": true,
"tag": "TEXTAREA",
"id": "readSubtrees",
"documentHasFocus": true
},
{
"inside": true,
"tag": "INPUT",
"id": "",
"documentHasFocus": true
},
{
"inside": true,
"tag": "INPUT",
"id": "",
"documentHasFocus": true
},
{
"inside": true,
"tag": "INPUT",
"id": "",
"documentHasFocus": true
},
{
"inside": true,
"tag": "INPUT",
"id": "",
"documentHasFocus": true
},
{
"inside": true,
"tag": "INPUT",
"id": "",
"documentHasFocus": true
},
{
"inside": true,
"tag": "INPUT",
"id": "",
"documentHasFocus": true
},
{
"inside": true,
"tag": "INPUT",
"id": "",
"documentHasFocus": true
},
{
"inside": true,
"tag": "INPUT",
"id": "",
"documentHasFocus": true
},
{
"inside": true,
"tag": "INPUT",
"id": "displayName",
"documentHasFocus": true
},
{
"inside": true,
"tag": "INPUT",
"id": "keyId",
"documentHasFocus": true
}
],
"validationInsideDialog": true
},
{
"width": 1024,
"dpr": 1,
"scroll": 1024,
"zoom": 1,
"nativeModal": true,
"outsideFocusBlocked": true,
"focusSamples": [
{
"inside": true,
"tag": "INPUT",
"id": "displayName",
"documentHasFocus": true
},
{
"inside": true,
"tag": "INPUT",
"id": "",
"documentHasFocus": true
},
{
"inside": true,
"tag": "INPUT",
"id": "",
"documentHasFocus": true
},
{
"inside": true,
"tag": "INPUT",
"id": "",
"documentHasFocus": true
},
{
"inside": true,
"tag": "INPUT",
"id": "",
"documentHasFocus": true
},
{
"inside": true,
"tag": "INPUT",
"id": "",
"documentHasFocus": true
},
{
"inside": true,
"tag": "INPUT",
"id": "",
"documentHasFocus": true
},
{
"inside": true,
"tag": "INPUT",
"id": "",
"documentHasFocus": true
},
{
"inside": true,
"tag": "INPUT",
"id": "",
"documentHasFocus": true
},
{
"inside": true,
"tag": "TEXTAREA",
"id": "readSubtrees",
"documentHasFocus": true
},
{
"inside": true,
"tag": "INPUT",
"id": "",
"documentHasFocus": true
},
{
"inside": true,
"tag": "INPUT",
"id": "",
"documentHasFocus": true
},
{
"inside": true,
"tag": "INPUT",
"id": "",
"documentHasFocus": true
},
{
"inside": true,
"tag": "INPUT",
"id": "",
"documentHasFocus": true
},
{
"inside": true,
"tag": "INPUT",
"id": "",
"documentHasFocus": true
},
{
"inside": true,
"tag": "INPUT",
"id": "",
"documentHasFocus": true
},
{
"inside": true,
"tag": "INPUT",
"id": "",
"documentHasFocus": true
},
{
"inside": true,
"tag": "INPUT",
"id": "",
"documentHasFocus": true
},
{
"inside": true,
"tag": "INPUT",
"id": "displayName",
"documentHasFocus": true
},
{
"inside": true,
"tag": "INPUT",
"id": "keyId",
"documentHasFocus": true
}
],
"validationInsideDialog": true
},
{
"width": 390,
"dpr": 1,
"scroll": 390,
"zoom": 1,
"nativeModal": true,
"outsideFocusBlocked": true,
"focusSamples": [
{
"inside": true,
"tag": "INPUT",
"id": "displayName",
"documentHasFocus": true
},
{
"inside": true,
"tag": "INPUT",
"id": "",
"documentHasFocus": true
},
{
"inside": true,
"tag": "INPUT",
"id": "",
"documentHasFocus": true
},
{
"inside": true,
"tag": "INPUT",
"id": "",
"documentHasFocus": true
},
{
"inside": true,
"tag": "INPUT",
"id": "",
"documentHasFocus": true
},
{
"inside": true,
"tag": "INPUT",
"id": "",
"documentHasFocus": true
},
{
"inside": true,
"tag": "INPUT",
"id": "",
"documentHasFocus": true
},
{
"inside": true,
"tag": "INPUT",
"id": "",
"documentHasFocus": true
},
{
"inside": true,
"tag": "INPUT",
"id": "",
"documentHasFocus": true
},
{
"inside": true,
"tag": "TEXTAREA",
"id": "readSubtrees",
"documentHasFocus": true
},
{
"inside": true,
"tag": "INPUT",
"id": "",
"documentHasFocus": true
},
{
"inside": true,
"tag": "INPUT",
"id": "",
"documentHasFocus": true
},
{
"inside": true,
"tag": "INPUT",
"id": "",
"documentHasFocus": true
},
{
"inside": true,
"tag": "INPUT",
"id": "",
"documentHasFocus": true
},
{
"inside": true,
"tag": "INPUT",
"id": "",
"documentHasFocus": true
},
{
"inside": true,
"tag": "INPUT",
"id": "",
"documentHasFocus": true
},
{
"inside": true,
"tag": "INPUT",
"id": "",
"documentHasFocus": true
},
{
"inside": true,
"tag": "INPUT",
"id": "",
"documentHasFocus": true
},
{
"inside": true,
"tag": "INPUT",
"id": "displayName",
"documentHasFocus": true
},
{
"inside": true,
"tag": "INPUT",
"id": "keyId",
"documentHasFocus": true
}
],
"validationInsideDialog": true
},
{
"width": 720,
"dpr": 2,
"scroll": 720,
"zoom": 2,
"nativeModal": true,
"outsideFocusBlocked": true,
"focusSamples": [
{
"inside": true,
"tag": "INPUT",
"id": "displayName",
"documentHasFocus": true
},
{
"inside": true,
"tag": "INPUT",
"id": "",
"documentHasFocus": true
},
{
"inside": true,
"tag": "INPUT",
"id": "",
"documentHasFocus": true
},
{
"inside": true,
"tag": "INPUT",
"id": "",
"documentHasFocus": true
},
{
"inside": true,
"tag": "INPUT",
"id": "",
"documentHasFocus": true
},
{
"inside": true,
"tag": "INPUT",
"id": "",
"documentHasFocus": true
},
{
"inside": true,
"tag": "INPUT",
"id": "",
"documentHasFocus": true
},
{
"inside": true,
"tag": "INPUT",
"id": "",
"documentHasFocus": true
},
{
"inside": true,
"tag": "INPUT",
"id": "",
"documentHasFocus": true
},
{
"inside": true,
"tag": "TEXTAREA",
"id": "readSubtrees",
"documentHasFocus": true
},
{
"inside": true,
"tag": "INPUT",
"id": "",
"documentHasFocus": true
},
{
"inside": true,
"tag": "INPUT",
"id": "",
"documentHasFocus": true
},
{
"inside": true,
"tag": "INPUT",
"id": "",
"documentHasFocus": true
},
{
"inside": true,
"tag": "INPUT",
"id": "",
"documentHasFocus": true
},
{
"inside": true,
"tag": "INPUT",
"id": "",
"documentHasFocus": true
},
{
"inside": true,
"tag": "INPUT",
"id": "",
"documentHasFocus": true
},
{
"inside": true,
"tag": "INPUT",
"id": "",
"documentHasFocus": true
},
{
"inside": true,
"tag": "INPUT",
"id": "",
"documentHasFocus": true
},
{
"inside": true,
"tag": "INPUT",
"id": "displayName",
"documentHasFocus": true
},
{
"inside": true,
"tag": "INPUT",
"id": "keyId",
"documentHasFocus": true
}
],
"validationInsideDialog": true
}
],
"slowBusyEscapeSingleDispatch": true,
"servedThemeCssSha256": "7a6da7aefcf036f971f18816e3ceb129f1abb4a39f6db33d449420b814cfb4a6",
"errors": []
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 87 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

@@ -0,0 +1,451 @@
{
"cases": [
{
"width": 1440,
"dpr": 1,
"scroll": 1440,
"zoom": 1,
"nativeModal": true,
"outsideFocusBlocked": true,
"focusSamples": [
{
"inside": false,
"tag": "BODY",
"id": ""
},
{
"inside": true,
"tag": "BUTTON",
"id": ""
},
{
"inside": true,
"tag": "INPUT",
"id": "keyId"
},
{
"inside": true,
"tag": "INPUT",
"id": "displayName"
},
{
"inside": true,
"tag": "INPUT",
"id": ""
},
{
"inside": true,
"tag": "INPUT",
"id": ""
},
{
"inside": true,
"tag": "INPUT",
"id": ""
},
{
"inside": true,
"tag": "INPUT",
"id": ""
},
{
"inside": true,
"tag": "INPUT",
"id": ""
},
{
"inside": true,
"tag": "INPUT",
"id": ""
},
{
"inside": true,
"tag": "INPUT",
"id": ""
},
{
"inside": true,
"tag": "INPUT",
"id": ""
},
{
"inside": true,
"tag": "INPUT",
"id": ""
},
{
"inside": true,
"tag": "INPUT",
"id": ""
},
{
"inside": true,
"tag": "INPUT",
"id": ""
},
{
"inside": true,
"tag": "INPUT",
"id": "displayName"
},
{
"inside": true,
"tag": "INPUT",
"id": "keyId"
},
{
"inside": true,
"tag": "BUTTON",
"id": ""
},
{
"inside": true,
"tag": "BUTTON",
"id": ""
},
{
"inside": true,
"tag": "BUTTON",
"id": ""
}
],
"validationInsideDialog": true
},
{
"width": 1024,
"dpr": 1,
"scroll": 1024,
"zoom": 1,
"nativeModal": true,
"outsideFocusBlocked": true,
"focusSamples": [
{
"inside": false,
"tag": "BODY",
"id": ""
},
{
"inside": true,
"tag": "BUTTON",
"id": ""
},
{
"inside": true,
"tag": "INPUT",
"id": "keyId"
},
{
"inside": true,
"tag": "INPUT",
"id": "displayName"
},
{
"inside": true,
"tag": "INPUT",
"id": ""
},
{
"inside": true,
"tag": "INPUT",
"id": ""
},
{
"inside": true,
"tag": "INPUT",
"id": ""
},
{
"inside": true,
"tag": "INPUT",
"id": ""
},
{
"inside": true,
"tag": "INPUT",
"id": ""
},
{
"inside": true,
"tag": "INPUT",
"id": ""
},
{
"inside": true,
"tag": "INPUT",
"id": ""
},
{
"inside": true,
"tag": "INPUT",
"id": ""
},
{
"inside": true,
"tag": "INPUT",
"id": ""
},
{
"inside": true,
"tag": "INPUT",
"id": ""
},
{
"inside": true,
"tag": "INPUT",
"id": ""
},
{
"inside": true,
"tag": "INPUT",
"id": "displayName"
},
{
"inside": true,
"tag": "INPUT",
"id": "keyId"
},
{
"inside": true,
"tag": "BUTTON",
"id": ""
},
{
"inside": true,
"tag": "BUTTON",
"id": ""
},
{
"inside": true,
"tag": "BUTTON",
"id": ""
}
],
"validationInsideDialog": true
},
{
"width": 390,
"dpr": 1,
"scroll": 390,
"zoom": 1,
"nativeModal": true,
"outsideFocusBlocked": true,
"focusSamples": [
{
"inside": false,
"tag": "BODY",
"id": ""
},
{
"inside": true,
"tag": "BUTTON",
"id": ""
},
{
"inside": true,
"tag": "INPUT",
"id": "keyId"
},
{
"inside": true,
"tag": "INPUT",
"id": "displayName"
},
{
"inside": true,
"tag": "INPUT",
"id": ""
},
{
"inside": true,
"tag": "INPUT",
"id": ""
},
{
"inside": true,
"tag": "INPUT",
"id": ""
},
{
"inside": true,
"tag": "INPUT",
"id": ""
},
{
"inside": true,
"tag": "INPUT",
"id": ""
},
{
"inside": true,
"tag": "INPUT",
"id": ""
},
{
"inside": true,
"tag": "INPUT",
"id": ""
},
{
"inside": true,
"tag": "INPUT",
"id": ""
},
{
"inside": true,
"tag": "INPUT",
"id": ""
},
{
"inside": true,
"tag": "INPUT",
"id": ""
},
{
"inside": true,
"tag": "INPUT",
"id": ""
},
{
"inside": true,
"tag": "INPUT",
"id": "displayName"
},
{
"inside": true,
"tag": "INPUT",
"id": "keyId"
},
{
"inside": true,
"tag": "BUTTON",
"id": ""
},
{
"inside": true,
"tag": "BUTTON",
"id": ""
},
{
"inside": true,
"tag": "BUTTON",
"id": ""
}
],
"validationInsideDialog": true
},
{
"width": 720,
"dpr": 2,
"scroll": 720,
"zoom": 2,
"nativeModal": true,
"outsideFocusBlocked": true,
"focusSamples": [
{
"inside": false,
"tag": "BODY",
"id": ""
},
{
"inside": true,
"tag": "BUTTON",
"id": ""
},
{
"inside": true,
"tag": "INPUT",
"id": "keyId"
},
{
"inside": true,
"tag": "INPUT",
"id": "displayName"
},
{
"inside": true,
"tag": "INPUT",
"id": ""
},
{
"inside": true,
"tag": "INPUT",
"id": ""
},
{
"inside": true,
"tag": "INPUT",
"id": ""
},
{
"inside": true,
"tag": "INPUT",
"id": ""
},
{
"inside": true,
"tag": "INPUT",
"id": ""
},
{
"inside": true,
"tag": "INPUT",
"id": ""
},
{
"inside": true,
"tag": "INPUT",
"id": ""
},
{
"inside": true,
"tag": "INPUT",
"id": ""
},
{
"inside": true,
"tag": "INPUT",
"id": ""
},
{
"inside": true,
"tag": "INPUT",
"id": ""
},
{
"inside": true,
"tag": "INPUT",
"id": ""
},
{
"inside": true,
"tag": "INPUT",
"id": "displayName"
},
{
"inside": true,
"tag": "INPUT",
"id": "keyId"
},
{
"inside": true,
"tag": "BUTTON",
"id": ""
},
{
"inside": true,
"tag": "BUTTON",
"id": ""
},
{
"inside": true,
"tag": "BUTTON",
"id": ""
}
],
"validationInsideDialog": true
}
],
"slowBusyEscapeSingleDispatch": true,
"servedThemeCssSha256": "7a6da7aefcf036f971f18816e3ceb129f1abb4a39f6db33d449420b814cfb4a6",
"errors": []
}
@@ -0,0 +1,8 @@
{
"pendingImportHidden": true,
"disposeBeforeImportCompletionNoResurrection": true,
"reopenAfterDisposal": true,
"connectedDisabledTriggerFallsBackToHeading": true,
"headingTabindexRemovedOnBlur": true,
"subsequentInstanceOpensAndCancels": true
}
@@ -0,0 +1,9 @@
{
"baseline": 341,
"after": 343,
"removed": [],
"added": [
"ZB.MOM.WW.MxGateway.Tests.Dashboard.ConfirmDialogRenderTests.BusyConfirmation_ExposesBusyStateAndRetainsDisabledActions",
"ZB.MOM.WW.MxGateway.Tests.Dashboard.ConfirmDialogRenderTests.RequestedConfirmation_RendersNamedNativeDialogAndSafeCancel"
]
}
@@ -0,0 +1,6 @@
{
"version": "1.0.1",
"sha256": "995b117b0245577598c91404ed7957c071ebe3413696c8be48b419c9deb1bd5d",
"source": "https://gitea.dohertylan.com/api/packages/dohertj2/nuget/index.json",
"servedCssSha256": "7a6da7aefcf036f971f18816e3ceb129f1abb4a39f6db33d449420b814cfb4a6"
}
@@ -0,0 +1,53 @@
[
{
"alert": {
"top": 80.390625,
"bottom": 134.78125
},
"dialog": {
"top": 16,
"bottom": 884
},
"body": null,
"visible": true,
"width": 1440,
"zoom": 1,
"initialKeyIdVisible": true,
"tabSamples": 60,
"chromeSamples": 1
},
{
"alert": {
"top": 80.390625,
"bottom": 134.78125
},
"dialog": {
"top": 16,
"bottom": 884
},
"body": null,
"visible": true,
"width": 390,
"zoom": 1,
"initialKeyIdVisible": true,
"tabSamples": 60,
"chromeSamples": 1
},
{
"alert": {
"top": 80.3984375,
"bottom": 134.796875
},
"dialog": {
"top": 16,
"bottom": 434
},
"body": null,
"visible": true,
"width": 720,
"zoom": 2,
"initialKeyIdVisible": true,
"tabSamples": 60,
"chromeSamples": 2
}
]
@@ -0,0 +1,62 @@
[
{
"alert": {
"top": -320.609375,
"bottom": -266.21875
},
"dialog": {
"top": 16,
"bottom": 884
},
"body": {
"top": 80.390625,
"bottom": 883
},
"visible": false,
"width": 1440,
"zoom": 1,
"initialKeyIdVisible": true,
"tabSamples": 60,
"chromeSamples": 1
},
{
"alert": {
"top": -665.609375,
"bottom": -611.21875
},
"dialog": {
"top": 16,
"bottom": 884
},
"body": {
"top": 80.390625,
"bottom": 883
},
"visible": false,
"width": 390,
"zoom": 1,
"initialKeyIdVisible": true,
"tabSamples": 60,
"chromeSamples": 1
},
{
"alert": {
"top": -840.6015625,
"bottom": -786.203125
},
"dialog": {
"top": 16,
"bottom": 434
},
"body": {
"top": 80.3984375,
"bottom": 433
},
"visible": false,
"width": 720,
"zoom": 2,
"initialKeyIdVisible": true,
"tabSamples": 60,
"chromeSamples": 2
}
]
@@ -0,0 +1,2 @@
@namespace MxUiCanary.Components
<!doctype html><html lang="en"><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><base href="/"/><link rel="stylesheet" href="/lib/bootstrap/css/bootstrap.min.css"/><ThemeHead/><link rel="stylesheet" href="/css/site.css"/></head><body class="dashboard-body"><FixtureBody @rendermode="InteractiveServer"/><script>window.mxCanaryReady=()=>document.documentElement.dataset.mxReady='true';</script><script src="/_framework/blazor.web.js"></script></body></html>
@@ -0,0 +1,18 @@
@namespace MxUiCanary.Components
@page "/"
@inject IJSRuntime JS
<ThemeShell Product="Synthetic MX UI canary">
<ChildContent>
<p>Synthetic local fixture: no gateway worker, key store, LDAP, COM or real write provider.</p>
<button id="slow-trigger" class="btn btn-secondary" @onclick="()=>_open=true">Open synthetic delayed confirmation</button>
<button id="outside" class="btn btn-secondary">Outside inertness probe</button>
<p id="counts">Synthetic confirms: @_count</p>
<ConfirmDialog IsOpen="@_open" IsBusy="@_busy" Title="Synthetic delayed operation" Message="Fixture only; no session or key is changed." OnCancel="()=>_open=false" OnConfirm="Confirm"/>
<ApiKeysPage/>
</ChildContent>
</ThemeShell>
@code {
bool _open;bool _busy;int _count;
protected override async Task OnAfterRenderAsync(bool firstRender) {if(firstRender)await JS.InvokeVoidAsync("mxCanaryReady");}
async Task Confirm(){if(_busy)return;_busy=true;_count++;await Task.Delay(1500);_busy=false;_open=false;}
}
@@ -0,0 +1,7 @@
@using Microsoft.AspNetCore.Components
@using Microsoft.AspNetCore.Components.Web
@using Microsoft.JSInterop
@using static Microsoft.AspNetCore.Components.Web.RenderMode
@using ZB.MOM.WW.Theme
@using ZB.MOM.WW.MxGateway.Server.Dashboard.Components.Shared
@using ZB.MOM.WW.MxGateway.Server.Dashboard.Components.Pages
+105
View File
@@ -0,0 +1,105 @@
using System.Runtime.CompilerServices;
using System.Security.Claims;
using Microsoft.AspNetCore.Components.Authorization;
using ZB.MOM.WW.MxGateway.Server.Dashboard;
using ZB.MOM.WW.MxGateway.Server.Security.Authentication;
using ZB.MOM.WW.MxGateway.Server.Security.Authorization;
internal sealed class StubSnapshotService : IDashboardSnapshotService
{
/// <inheritdoc />
public DashboardSnapshot GetSnapshot() => new(
GeneratedAt: DateTimeOffset.UnixEpoch,
GatewayStartedAt: DateTimeOffset.UnixEpoch,
GatewayUptime: TimeSpan.Zero,
GatewayStatus: "Healthy",
GatewayVersion: "test",
Sessions: [],
Workers: [],
Metrics: [],
Faults: [],
ApiKeys:
[
new DashboardApiKeySummary(
KeyId: "synthetic-tagged",
DisplayName: "Tags only",
Scopes: new HashSet<string>(StringComparer.Ordinal),
Constraints: ApiKeyConstraints.Empty with { DashboardTags = ["team-a", "team-b"] },
CreatedUtc: DateTimeOffset.UnixEpoch,
LastUsedUtc: null,
RevokedUtc: null),
new DashboardApiKeySummary(
KeyId: "synthetic-plain",
DisplayName: "Unconstrained",
Scopes: new HashSet<string>(StringComparer.Ordinal),
Constraints: ApiKeyConstraints.Empty,
CreatedUtc: DateTimeOffset.UnixEpoch,
LastUsedUtc: null,
RevokedUtc: null),
],
Configuration: null!,
Galaxy: null!);
/// <inheritdoc />
public IAsyncEnumerable<DashboardSnapshot> WatchSnapshotsAsync(CancellationToken cancellationToken) =>
new IdleSnapshotFeed().WatchAsync(cancellationToken);
}
// Parks until the page is disposed, so the base page's watch loop neither spins nor pushes a
// second snapshot mid-render.
internal sealed class IdleSnapshotFeed : IDashboardSnapshotFeed
{
/// <inheritdoc />
public async IAsyncEnumerable<DashboardSnapshot> WatchAsync(
[EnumeratorCancellation] CancellationToken cancellationToken)
{
await Task.Delay(Timeout.Infinite, cancellationToken).ConfigureAwait(false);
yield break;
}
}
// Grants management so the create dialog is reachable; no test here exercises a mutation.
internal sealed class ManagingApiKeyService : IDashboardApiKeyManagementService
{
/// <inheritdoc />
public bool CanManage(ClaimsPrincipal user) => true;
/// <inheritdoc />
public Task<DashboardApiKeyManagementResult> CreateAsync(
ClaimsPrincipal user,
DashboardApiKeyManagementRequest request,
CancellationToken cancellationToken) =>
Task.FromResult(DashboardApiKeyManagementResult.Fail("not exercised"));
/// <inheritdoc />
public Task<DashboardApiKeyManagementResult> RevokeAsync(
ClaimsPrincipal user,
string keyId,
CancellationToken cancellationToken) =>
Task.FromResult(DashboardApiKeyManagementResult.Fail("not exercised"));
/// <inheritdoc />
public Task<DashboardApiKeyManagementResult> RotateAsync(
ClaimsPrincipal user,
string keyId,
CancellationToken cancellationToken) =>
Task.FromResult(DashboardApiKeyManagementResult.Fail("not exercised"));
/// <inheritdoc />
public Task<DashboardApiKeyManagementResult> DeleteAsync(
ClaimsPrincipal user,
string keyId,
CancellationToken cancellationToken) =>
Task.FromResult(DashboardApiKeyManagementResult.Fail("not exercised"));
}
internal sealed class StubAuthenticationStateProvider : AuthenticationStateProvider
{
/// <inheritdoc />
public override Task<AuthenticationState> GetAuthenticationStateAsync() =>
Task.FromResult(new AuthenticationState(new ClaimsPrincipal(new ClaimsIdentity(
[new Claim(ClaimTypes.Name, "admin-user"), new Claim(ClaimTypes.Role, DashboardRoles.Admin)],
authenticationType: "test",
nameType: ClaimTypes.Name,
roleType: ClaimTypes.Role))));
}
@@ -0,0 +1,2 @@
<Project Sdk="Microsoft.NET.Sdk.Web"><PropertyGroup><TargetFramework>net10.0</TargetFramework><Nullable>enable</Nullable><ImplicitUsings>enable</ImplicitUsings></PropertyGroup><ItemGroup><ProjectReference Include="../../../src/ZB.MOM.WW.MxGateway.Server/ZB.MOM.WW.MxGateway.Server.csproj" /></ItemGroup>
<Target Name="DeduplicateFixtureFrameworkAssets" BeforeTargets="ResolveBuildCompressedStaticWebAssetsConfiguration"><RemoveDuplicates Inputs="@(StaticWebAsset)"><Output TaskParameter="Filtered" ItemName="_UniqueFixtureStaticWebAsset" /></RemoveDuplicates><ItemGroup><StaticWebAsset Remove="@(StaticWebAsset)" /><StaticWebAsset Include="@(_UniqueFixtureStaticWebAsset)" /></ItemGroup></Target></Project>
+18
View File
@@ -0,0 +1,18 @@
using Microsoft.AspNetCore.Components.Authorization;
using Microsoft.Extensions.FileProviders;
using MxUiCanary.Components;
using ZB.MOM.WW.MxGateway.Server.Dashboard;
var builder = WebApplication.CreateBuilder(args);
builder.WebHost.UseUrls("http://127.0.0.1:0");
builder.WebHost.UseStaticWebAssets();
builder.Services.AddRazorComponents().AddInteractiveServerComponents();
builder.Services.AddSingleton<IDashboardSnapshotService, StubSnapshotService>();
builder.Services.AddSingleton<IDashboardSnapshotFeed, IdleSnapshotFeed>();
builder.Services.AddSingleton<IDashboardApiKeyManagementService, ManagingApiKeyService>();
builder.Services.AddSingleton<AuthenticationStateProvider, StubAuthenticationStateProvider>();
var app = builder.Build();
app.UseStaticFiles(new StaticFileOptions { FileProvider = new PhysicalFileProvider(Path.GetFullPath("../../../src/ZB.MOM.WW.MxGateway.Server/wwwroot")) });
app.UseStaticFiles();app.UseAntiforgery();
app.MapRazorComponents<FixtureApp>().AddInteractiveServerRenderMode();
app.MapGet("/provenance",()=>new { theme=typeof(ZB.MOM.WW.Theme.ThemeShell).Assembly.GetName().Version?.ToString(), syntheticOnly=true });
app.Run();
@@ -0,0 +1,43 @@
"""Actual MX components; fixture-only services, no production operations."""
import json,sys,hashlib
from pathlib import Path
from playwright.sync_api import sync_playwright
ROOT=Path(__file__).resolve().parent
sys.path.insert(0,'/Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/components/ui-theme/validation/theme-1.0.0/canary')
from browser_zoom import zoom_browser,set_browser_zoom
BASE=json.load(open('/tmp/mx-ui-canary-state.json'))['origin'];OUT=ROOT/'evidence/mx02/browser-confirmation';OUT.mkdir(exist_ok=True)
results=[];errors=[]
with sync_playwright() as p:
with zoom_browser(p) as (ctx,worker):
page=ctx.new_page();page.on('pageerror',lambda e:errors.append(str(e)))
for width,zoom in [(1440,1),(1024,1),(390,1),(1440,2)]:
page.set_viewport_size({'width':width,'height':900});page.goto(BASE);page.wait_for_selector('html[data-mx-ready="true"]');page.evaluate('document.fonts.ready')
set_browser_zoom(worker,page,zoom)
trigger=page.get_by_role('button',name='Create API Key',exact=True);trigger.focus();trigger.press('Enter')
dialog=page.locator('dialog:modal');dialog.wait_for()
page.wait_for_function("document.querySelector('dialog:modal [data-dialog-initial]')===document.activeElement")
focus=[]
for key in ['Tab']*10+['Shift+Tab']*10:
page.keyboard.press(key);focus.append(page.evaluate("({inside:document.querySelector('dialog:modal').contains(document.activeElement),tag:document.activeElement.tagName,id:document.activeElement.id,documentHasFocus:document.hasFocus()})"))
assert all(s['inside'] or not s['documentHasFocus'] for s in focus)
page.locator('#outside').evaluate('(e)=>e.focus()');assert page.evaluate("document.querySelector('dialog:modal').contains(document.activeElement)")
page.get_by_role('button',name='Save',exact=True).click();dialog.get_by_role('alert').wait_for()
assert not dialog.get_by_role('alert').inner_text().startswith('mxgw_')
page.screenshot(path=str(OUT/f'create-{width}-zoom{zoom}.png'),full_page=False)
results.append({'width':page.evaluate('innerWidth'),'dpr':page.evaluate('devicePixelRatio'),'scroll':page.evaluate('document.documentElement.scrollWidth'),'zoom':zoom,'nativeModal':True,'outsideFocusBlocked':True,'focusSamples':focus,'validationInsideDialog':True})
page.keyboard.press('Escape');page.wait_for_function("!document.querySelector('dialog:modal')")
page.wait_for_function("document.activeElement.textContent.trim()==='Create API Key'")
set_browser_zoom(worker,page,1)
page.set_viewport_size({'width':390,'height':844})
trigger=page.locator('#slow-trigger');trigger.click();page.locator('dialog:modal').wait_for()
page.get_by_role('button',name='Confirm',exact=True).click()
page.keyboard.press('Escape')
page.wait_for_timeout(200);assert page.locator('dialog:modal').count()==1
assert page.locator('#counts').inner_text()=='Synthetic confirms: 1'
page.wait_for_function("!document.querySelector('dialog:modal')")
page.wait_for_function("document.activeElement.id==='slow-trigger'")
# CSS delivery parity independently of assembly version.
href=next(h for h in page.locator('link[rel=stylesheet]').evaluate_all('(es)=>es.map(e=>e.href)') if h.endswith('/css/theme.css'))
csssha=hashlib.sha256(page.request.get(href).body()).hexdigest();assert csssha=='7a6da7aefcf036f971f18816e3ceb129f1abb4a39f6db33d449420b814cfb4a6'
record={'cases':results,'slowBusyEscapeSingleDispatch':True,'servedThemeCssSha256':csssha,'errors':errors}
(OUT/'results.json').write_text(json.dumps(record,indent=2));print(json.dumps({'cases':len(results),'errors':errors,'outsideTabSamples':[r for case in results for r in case['focusSamples'] if not r['inside']]},indent=2))
@@ -0,0 +1,37 @@
"""Focused native lifecycle checks; no broad screenshot iteration."""
import asyncio,json
from pathlib import Path
from playwright.async_api import async_playwright
ROOT=Path(__file__).resolve().parent;BASE=json.load(open('/tmp/mx-ui-canary-state.json'))['origin']
async def main():
async with async_playwright() as p:
browser=await p.chromium.launch(channel='chromium',headless=True);page=await browser.new_page()
release=asyncio.Event();requested=asyncio.Event()
async def hold(route):
requested.set();await release.wait();await route.continue_()
await page.route('**/js/dashboard-dialog.js',hold)
await page.goto(BASE);await page.wait_for_selector('html[data-mx-ready="true"]')
await page.get_by_role('button',name='Create API Key',exact=True).click();await asyncio.wait_for(requested.wait(),10)
dialog=page.locator('dialog.api-key-create-modal');assert await dialog.count()==1
assert not await dialog.is_visible(), 'Requested native dialog must stay hidden until showModal'
# Close the parent while its import is pending. Completion must not resurrect it.
await page.locator('#outside').focus()
# Its visible trigger remains usable while native activation has not happened.
await page.evaluate("document.querySelector('dialog.api-key-create-modal button[aria-label=\"Close create API key\"]').click()")
await page.wait_for_function("!document.querySelector('dialog.api-key-create-modal')")
release.set();await page.wait_for_timeout(300)
assert await page.locator('dialog:modal').count()==0
await page.unroute('**/js/dashboard-dialog.js',hold)
# Reopen after disposal, then make the connected trigger unusable before cancel.
trigger=page.get_by_role('button',name='Create API Key',exact=True)
await trigger.click();await page.locator('dialog:modal').wait_for()
await trigger.evaluate('(e)=>e.disabled=true')
await page.keyboard.press('Escape');await page.wait_for_function("!document.querySelector('dialog:modal')")
await page.wait_for_function("document.activeElement.tagName==='H1'")
assert await page.locator('h1').get_attribute('tabindex')=='-1'
await page.locator('#outside').focus();assert await page.locator('h1').get_attribute('tabindex') is None
# Idempotent listener cleanup permits another instance after cancelled/disposed import.
await page.locator('#slow-trigger').click();await page.locator('dialog:modal').wait_for();await page.keyboard.press('Escape');await page.wait_for_function("!document.querySelector('dialog:modal')")
(ROOT/'evidence/mx02/lifecycle.json').write_text(json.dumps({'pendingImportHidden':True,'disposeBeforeImportCompletionNoResurrection':True,'reopenAfterDisposal':True,'connectedDisabledTriggerFallsBackToHeading':True,'headingTabindexRemovedOnBlur':True,'subsequentInstanceOpensAndCancels':True},indent=2))
await browser.close();print('Focused native lifecycle checks passed')
asyncio.run(main())
@@ -0,0 +1,66 @@
# MX native-dialog pilot
Implemented and verified locally 2026-11-13 on codex/scada-ui-consistency.
No deployment, COM/worker interaction, real API key creation or session operation.
Shared Theme is exact 1.0.1, with official-source/package and served-CSS hash proof
in `evidence/mx02/theme-package.json`. Secrets packages remain 0.6.2 pending the
separately reviewed shared Secrets release. Blue/IBM Plex/shared semantic inks
retain the family contract. Native dialog geometry is local pilot code, not a
new shared package or an extraction decision.
The app-local NativeDialog adapter is used by existing ConfirmDialog callers and
the API-key create form. Native showModal supplies top-layer presentation and
background inertness. Native Tab behavior is preserved. Confirmations initially
focus Cancel; the long create form starts on visible Key ID. Native cancel is
prevented synchronously, then delegated to current-generation safe parent cancel
only while idle. Busy and dispatch ownership remain in existing pages. JS receives
DOM references, busy/generation metadata and cancel callback only: no form fields,
key value, operation or token.
Lifecycle import/open/close/dispose is serialized. Changed target generations and
disposal reject obsolete completion; interop listeners/module and DotNet reference
are released. Client MutationObserver cleanup covers removed nodes when a lost
circuit cannot call JS disposal. A second active native modal is refused. Focus
returns to a usable connected trigger; otherwise the page heading gets temporary
programmatic focus, with tabindex removed on blur. A newly claimed outside focus
is respected. Native backdrop is the only dimming layer.
## Observed checks
- Baseline 341 dashboard tests passed. Two semantic tests failed on the old overlay,
then 10 focused tests passed; 343 dashboard tests pass with every 341 prior test
identity retained, no failures/skips. Framework HtmlRenderer is preserved; bUnit
was not added. Final validation-markup adjustment has 10 focused tests plus actual
browser rectangle verification. Full gateway tests remain for chapter acceptance.
- Actual components and existing create form run with inert snapshots and fake
management/auth services in an OS-port loopback host. No production providers.
Fixture source is `host/`; build outputs are task-local /tmp artifacts.
- First batched browser pass and one confirmation cover 1440,1024, 390 and real 200%
zoom (720 CSS px/DPR 2). Initial focus, native modal/background inertness, keyboard
scope, Escape/cancel, focus return and exactly one delayed synthetic confirm while
Escape is pressed pass. No browser page errors; no document overflow. Served
Theme CSS equals the published exact package.
- The correction batch removed legacy forced display on the native create class,
supplied header/body/footer padding previously inherited from Bootstrap's old
outer modal variables, and chose the visible initial form field.
- A focused functional regression subsequently reproduced an offscreen validation
alert in the independently scrolling form body. Fixed non-sensitive feedback now
stays between the header and bounded flex body. Red and green rectangle evidence
at 1440/390/200% prove visibility; 180 Tab samples keep application focus inside the
modal. Browser chrome samples are explicitly document.hasFocus=false.
- Focused lifecycle checks prove requested dialog hidden during deferred import,
disposal before completion without resurrection, reopen, connected-disabled
trigger fallback, heading tabindex cleanup and subsequent-instance cancellation.
A native dialog may Tab to browser chrome; this is permitted by
[W3C H102](https://www.w3.org/WAI/WCAG22/Techniques/html/H102). Checks distinguish
that document-unfocused state from focus reaching an underlying application
control. This avoids adding a custom Tab trap contrary to the native pilot plan.
Independent source review is retained in the umbrella's
`components/ui-theme/validation/mx-ui/native-dialog-review.md`; the subsequent
validation visibility fix is supported by focused browser evidence. One-time-key
handling, policies, request construction and service interfaces are unchanged.
Human screen-reader listening and additional browser engines are not claimed.
OEE-02 may now implement the second native pilot; shared extraction waits for G2.
@@ -0,0 +1,26 @@
"""Focused validation/focus contract, not an additional visual polish pass."""
import json,sys
from pathlib import Path
from playwright.sync_api import sync_playwright
ROOT=Path(__file__).resolve().parent
sys.path.insert(0,'/Users/dohertj2/.codex/worktrees/scada-ui-consistency/scadaproj/components/ui-theme/validation/theme-1.0.0/canary')
from browser_zoom import zoom_browser,set_browser_zoom
BASE=json.load(open('/tmp/mx-ui-canary-state.json'))['origin'];measurements=[]
with sync_playwright() as p:
with zoom_browser(p) as (ctx,worker):
page=ctx.new_page()
for width,zoom in [(1440,1),(390,1),(1440,2)]:
page.set_viewport_size({'width':width,'height':900});page.goto(BASE);page.wait_for_selector('html[data-mx-ready="true"]');set_browser_zoom(worker,page,zoom)
page.get_by_role('button',name='Create API Key',exact=True).click();page.locator('dialog:modal').wait_for()
page.wait_for_function("document.querySelector('#keyId')===document.activeElement")
initial=page.locator('#keyId').evaluate('(e)=>{const r=e.getBoundingClientRect();return r.top>=0&&r.bottom<=innerHeight}')
samples=[]
for _ in range(60):
page.keyboard.press('Tab');samples.append(page.evaluate("({inside:document.querySelector('dialog:modal').contains(document.activeElement),documentHasFocus:document.hasFocus()})"))
assert all(s['inside'] or not s['documentHasFocus'] for s in samples)
page.get_by_role('button',name='Save',exact=True).click();page.locator('dialog:modal').get_by_role('alert').wait_for()
measure=page.locator('dialog:modal').get_by_role('alert').evaluate('''e=>{const r=e.getBoundingClientRect(),d=e.closest('dialog').getBoundingClientRect();const scroll=e.closest('.modal-body');const s=scroll?.getBoundingClientRect();return {alert:{top:r.top,bottom:r.bottom},dialog:{top:d.top,bottom:d.bottom},body:s?{top:s.top,bottom:s.bottom}:null,visible:r.top>=Math.max(0,d.top,s?.top??0)&&r.bottom<=Math.min(innerHeight,d.bottom,s?.bottom??innerHeight)}}''')
measure.update(width=page.evaluate('innerWidth'),zoom=zoom,initialKeyIdVisible=initial,tabSamples=len(samples),chromeSamples=sum(not s['documentHasFocus'] for s in samples));measurements.append(measure)
page.keyboard.press('Escape');page.wait_for_function("!document.querySelector('dialog:modal')");set_browser_zoom(worker,page,1)
path=ROOT/'evidence/mx02'/sys.argv[1];path.write_text(json.dumps(measurements,indent=2));print(json.dumps(measurements,indent=2))
assert all(m['visible'] and m['initialKeyIdVisible'] for m in measurements),'Validation or initial field outside visible modal viewport'