\ No newline at end of file
diff --git a/docs/ui-validation/host/Components/FixtureBody.razor b/docs/ui-validation/host/Components/FixtureBody.razor
new file mode 100644
index 00000000..415ebf8c
--- /dev/null
+++ b/docs/ui-validation/host/Components/FixtureBody.razor
@@ -0,0 +1,18 @@
+@namespace MxUiCanary.Components
+@page "/"
+@inject IJSRuntime JS
+
+
+
Synthetic local fixture: no gateway worker, key store, LDAP, COM or real write provider.
+
+
+
Synthetic confirms: @_count
+
+
+
+
+@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;}
+}
diff --git a/docs/ui-validation/host/Components/_Imports.razor b/docs/ui-validation/host/Components/_Imports.razor
new file mode 100644
index 00000000..95b28279
--- /dev/null
+++ b/docs/ui-validation/host/Components/_Imports.razor
@@ -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
diff --git a/docs/ui-validation/host/Fakes.cs b/docs/ui-validation/host/Fakes.cs
new file mode 100644
index 00000000..9711f98d
--- /dev/null
+++ b/docs/ui-validation/host/Fakes.cs
@@ -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
+ {
+ ///
+ 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(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(StringComparer.Ordinal),
+ Constraints: ApiKeyConstraints.Empty,
+ CreatedUtc: DateTimeOffset.UnixEpoch,
+ LastUsedUtc: null,
+ RevokedUtc: null),
+ ],
+ Configuration: null!,
+ Galaxy: null!);
+
+ ///
+ public IAsyncEnumerable 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
+ {
+ ///
+ public async IAsyncEnumerable 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
+ {
+ ///
+ public bool CanManage(ClaimsPrincipal user) => true;
+
+ ///
+ public Task CreateAsync(
+ ClaimsPrincipal user,
+ DashboardApiKeyManagementRequest request,
+ CancellationToken cancellationToken) =>
+ Task.FromResult(DashboardApiKeyManagementResult.Fail("not exercised"));
+
+ ///
+ public Task RevokeAsync(
+ ClaimsPrincipal user,
+ string keyId,
+ CancellationToken cancellationToken) =>
+ Task.FromResult(DashboardApiKeyManagementResult.Fail("not exercised"));
+
+ ///
+ public Task RotateAsync(
+ ClaimsPrincipal user,
+ string keyId,
+ CancellationToken cancellationToken) =>
+ Task.FromResult(DashboardApiKeyManagementResult.Fail("not exercised"));
+
+ ///
+ public Task DeleteAsync(
+ ClaimsPrincipal user,
+ string keyId,
+ CancellationToken cancellationToken) =>
+ Task.FromResult(DashboardApiKeyManagementResult.Fail("not exercised"));
+ }
+
+ internal sealed class StubAuthenticationStateProvider : AuthenticationStateProvider
+ {
+ ///
+ public override Task 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))));
+ }
\ No newline at end of file
diff --git a/docs/ui-validation/host/MxUiCanary.csproj b/docs/ui-validation/host/MxUiCanary.csproj
new file mode 100644
index 00000000..79f0820f
--- /dev/null
+++ b/docs/ui-validation/host/MxUiCanary.csproj
@@ -0,0 +1,2 @@
+net10.0enableenable
+
\ No newline at end of file
diff --git a/docs/ui-validation/host/Program.cs b/docs/ui-validation/host/Program.cs
new file mode 100644
index 00000000..78ea5f5b
--- /dev/null
+++ b/docs/ui-validation/host/Program.cs
@@ -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();
+builder.Services.AddSingleton();
+builder.Services.AddSingleton();
+builder.Services.AddSingleton();
+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().AddInteractiveServerRenderMode();
+app.MapGet("/provenance",()=>new { theme=typeof(ZB.MOM.WW.Theme.ThemeShell).Assembly.GetName().Version?.ToString(), syntheticOnly=true });
+app.Run();
diff --git a/docs/ui-validation/native_dialog_browser.py b/docs/ui-validation/native_dialog_browser.py
new file mode 100644
index 00000000..b9e0f555
--- /dev/null
+++ b/docs/ui-validation/native_dialog_browser.py
@@ -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))
diff --git a/docs/ui-validation/native_dialog_lifecycle.py b/docs/ui-validation/native_dialog_lifecycle.py
new file mode 100644
index 00000000..0810ef08
--- /dev/null
+++ b/docs/ui-validation/native_dialog_lifecycle.py
@@ -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())
diff --git a/docs/ui-validation/technical-light-dialogs.md b/docs/ui-validation/technical-light-dialogs.md
new file mode 100644
index 00000000..0d88903a
--- /dev/null
+++ b/docs/ui-validation/technical-light-dialogs.md
@@ -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.
diff --git a/docs/ui-validation/validation_visibility.py b/docs/ui-validation/validation_visibility.py
new file mode 100644
index 00000000..0358d8bf
--- /dev/null
+++ b/docs/ui-validation/validation_visibility.py
@@ -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'
diff --git a/src/ZB.MOM.WW.MxGateway.Server/Dashboard/Components/Pages/ApiKeysPage.razor b/src/ZB.MOM.WW.MxGateway.Server/Dashboard/Components/Pages/ApiKeysPage.razor
index 62009d25..991a2c7e 100644
--- a/src/ZB.MOM.WW.MxGateway.Server/Dashboard/Components/Pages/ApiKeysPage.razor
+++ b/src/ZB.MOM.WW.MxGateway.Server/Dashboard/Components/Pages/ApiKeysPage.razor
@@ -51,9 +51,7 @@ else
@if (IsCreateDialogOpen)
{
-
-
-
+
@* Master SiteForm pattern: card-wrapped body with stacked
subsections (h6 text-muted border-bottom). Modal chrome
@@ -63,8 +61,12 @@ else
inline at the bottom of the card-body (no modal-footer). *@