Files
lmxopcua/src/Server/ZB.MOM.WW.OtOpcUa.AdminUI/Components/Pages/Dev/ContextMenuDemo.razor
T
Joseph Doherty c3277b52c9 review(track0): async ContextMenu OnClick + keyboard-⋯ anchoring + focus-return; discovery-driven DriverTypeNames guard; CSV round-trip comment
Wave-0 reviewer findings (no Critical/High):
- T0-1 M: ContextMenuItem.OnClick Action→Func<Task> (kills async-void at menu call sites Wave A/B/C need); keyboard-activated ⋯ now anchors below the button instead of viewport (0,0); focus returns to trigger on close; backdrop closes on native right-click too.
- T0-3 M: guard test now discovers *DriverFactoryExtensions.Register by convention from the deployed driver assemblies instead of a hand-copied list, so a future driver lacking a constant is actually caught.
- T0-2 L: corrected the round-trip 'sole non-round-trippable shape' comment (any table whose final row is a lone empty field).

Claude-Session: https://claude.ai/code/session_01LVneM3eh1UtJxEisFXgmox
2026-07-16 02:17:37 -04:00

40 lines
1.3 KiB
Plaintext

@page "/dev/context-menu-demo"
@* Dev-only host page to live-verify the reusable ContextMenu component. *@
@attribute [Authorize(Policy = AdminUiPolicies.AuthenticatedRead)]
@rendermode InteractiveServer
<PageTitle>ContextMenu demo</PageTitle>
<h1>ContextMenu demo</h1>
<p>Right-click the card below, or use the <strong>⋯</strong> button.</p>
<div style="display:flex; align-items:center; gap:1rem; margin:1rem 0;">
<ContextMenu Items="_items" ShowEllipsis="false">
<div style="padding:2rem 3rem; border:1px dashed var(--bs-border-color); border-radius:.5rem; user-select:none;">
Right-click me
</div>
</ContextMenu>
<ContextMenu Items="_items" ShowEllipsis="true" />
</div>
<p>Last action: <strong>@_lastAction</strong></p>
@code {
private string _lastAction = "(none)";
private IReadOnlyList<ContextMenuItem> _items => new List<ContextMenuItem>
{
new() { Label = "Edit", Icon = "✏️", OnClick = () => Set("Edit") },
new() { Label = "Duplicate", Icon = "📄", OnClick = () => Set("Duplicate") },
ContextMenuItem.Separator(),
new() { Label = "Delete", Icon = "🗑️", Disabled = true, OnClick = () => Set("Delete") },
};
private Task Set(string action)
{
_lastAction = action;
return Task.CompletedTask;
}
}