Complete common picker and tree field accessibility

This commit is contained in:
Joseph Doherty
2026-11-13 21:52:00 -05:00
parent 25e78ebe92
commit b990ebe3ea
43 changed files with 2581 additions and 74 deletions
@@ -36,7 +36,7 @@
<div @key="node.Key" class="d-flex align-items-center gap-1 py-1" style="@indent">
@if (hasExpander)
{
<button type="button" class="btn btn-sm btn-link p-0 tree-twist"
<button type="button" class="btn btn-sm btn-link p-0 tree-twist" aria-label="@((node.Expanded ? "Collapse " : "Expand ") + node.DisplayName)" aria-expanded="@(node.Expanded ? "true" : "false")"
@onclick="@(() => ToggleAsync(node))">
@(node.Expanded ? "▼" : "▶")
</button>
@@ -48,7 +48,7 @@
@if (node.Selectable)
{
<button type="button"
<button type="button" aria-pressed="@(selected ? "true" : "false")"
class="btn btn-sm p-0 px-1 border-0 d-inline-flex align-items-center gap-1 @(selected ? "bg-primary text-white rounded" : "btn-link text-decoration-none")"
@onclick="@(() => OnSelect.InvokeAsync(node))">
<span aria-hidden="true">@node.Icon</span>
@@ -132,7 +132,7 @@
<div class="d-flex align-items-center gap-1 py-1 @selectedCls" style="@indent">
@if (item.Node.Kind == BrowseNodeKind.Folder && item.Node.HasChildrenHint)
{
<button type="button" class="btn btn-sm btn-link p-0 tree-twist"
<button type="button" class="btn btn-sm btn-link p-0 tree-twist" aria-label="@((item.Expanded ? "Collapse " : "Expand ") + item.Node.DisplayName)" aria-expanded="@(item.Expanded ? "true" : "false")"
@onclick="@(() => ToggleAsync(item))">
@(item.Expanded ? "▼" : "▶")
</button>
@@ -153,7 +153,7 @@
required clicking a label rather than the ▶ toggle (a button, which always worked). *@
@if (isMultiLeaf)
{
<input type="checkbox" class="form-check-input" checked="@IsLeafSelected(item.Node.NodeId)"
<input aria-label="@("Select " + item.Node.DisplayName)" type="checkbox" class="form-check-input" checked="@IsLeafSelected(item.Node.NodeId)"
@onchange="@(() => ToggleLeafAsync(item, ancestorPath))" />
<button type="button" @onclick="@(() => ToggleLeafAsync(item, ancestorPath))"
class="btn btn-link btn-sm p-0 text-decoration-none mono small text-start">@item.Node.DisplayName</button>
@@ -182,7 +182,7 @@
}
else if (item.Expanded && item.Loaded && item.Children is { Count: > 0 })
{
<input type="text" class="form-control form-control-sm mt-1"
<input aria-label="@("Filter children of " + item.Node.DisplayName)" type="text" class="form-control form-control-sm mt-1"
placeholder="filter children..."
style="@($"width:calc(100% - {(depth + 2) * 18}px); margin-left:{(depth + 2) * 18}px")"
@bind="item.Filter" @bind:event="oninput" />
@@ -27,7 +27,7 @@
anywhere. Offering an operator a control that silently does nothing is worse than not
offering it. *@
<div class="table-wrap mt-3">
<div class="table-wrap mt-3" role="region" aria-label="Resilience overrides" tabindex="0">
<table class="data-table">
<thead><tr><th scope="col">Capability</th><th scope="col" id="@FieldId("timeout")">Timeout (s)</th><th scope="col" id="@FieldId("retries")">Retries</th><th scope="col" id="@FieldId("breaker")">Breaker threshold</th></tr></thead>
<tbody>
@@ -12,22 +12,22 @@
<div class="row g-3">
<div class="col-md-6">
<label class="form-label">Tag name</label>
<input type="text" class="form-control form-control-sm mono" placeholder="Program:Main.MyTag"
<label for="@FieldId("field-01")" class="form-label">Tag name</label>
<input aria-describedby="@FieldIds("field-01-hint")" id="@FieldId("field-01")" type="text" class="form-control form-control-sm mono" placeholder="Program:Main.MyTag"
@bind="_tagName" @bind:after="OnChangedAsync" />
<div class="form-text">Use dot notation for nested tags or UDT members.</div>
<div id="@FieldId("field-01-hint")" class="form-text">Use dot notation for nested tags or UDT members.</div>
</div>
<div class="col-md-3">
<label class="form-label">Element index (optional)</label>
<input type="number" class="form-control form-control-sm" min="0"
<label for="@FieldId("field-02")" class="form-label">Element index (optional)</label>
<input aria-describedby="@FieldIds("field-02-hint")" id="@FieldId("field-02")" type="number" class="form-control form-control-sm" min="0"
@bind="_elementIndex" @bind:after="OnChangedAsync" />
<div class="form-text">Leave 0 for non-array tags (no index appended).</div>
<div id="@FieldId("field-02-hint")" class="form-text">Leave 0 for non-array tags (no index appended).</div>
</div>
<div class="col-md-3 d-flex align-items-end">
<div class="form-check mb-2">
<input type="checkbox" class="form-check-input" id="abCipUseIdx"
<input type="checkbox" class="form-check-input" id="@FieldId("abCipUseIdx")"
@bind="_useIndex" @bind:after="OnChangedAsync" />
<label class="form-check-label" for="abCipUseIdx">Append index</label>
<label class="form-check-label" for="@FieldId("abCipUseIdx")">Append index</label>
</div>
</div>
</div>
@@ -76,6 +76,10 @@
</div>
@code {
private readonly string _fieldScope = "ab-cip-address-picker-body-" + Guid.NewGuid().ToString("N");
private string FieldIds(params string[] names) => string.Join(" ", names.Select(FieldId));
private string FieldId(string name) => $"{_fieldScope}-{name}";
[Parameter] public string CurrentAddress { get; set; } = "";
[Parameter] public EventCallback<string> CurrentAddressChanged { get; set; }
/// <summary>Driver type used to open a universal browse session (defaults to AbCip).</summary>
@@ -23,8 +23,8 @@
<div class="row g-3">
<div class="col-md-3">
<label class="form-label">Address space</label>
<select class="form-select form-select-sm" @bind="_kind" @bind:after="OnChangedAsync">
<label for="@FieldId("field-01")" class="form-label">Address space</label>
<select id="@FieldId("field-01")" class="form-select form-select-sm" @bind="_kind" @bind:after="OnChangedAsync">
<option value="@FocasManualAddressKind.Pmc">PMC</option>
<option value="@FocasManualAddressKind.Parameter">CNC parameter</option>
<option value="@FocasManualAddressKind.Macro">Macro variable</option>
@@ -36,8 +36,8 @@
@* Gitea #647: an ALARM: selector — one Part 9 condition per tag. The tag must also carry the native-alarm
object (alarm section of the tag modal), or it is neither a condition nor a value. *@
<div class="col-md-3">
<label class="form-label">Alarms</label>
<select class="form-select form-select-sm" @bind="_alarmScope" @bind:after="OnChangedAsync">
<label for="@FieldId("field-02")" class="form-label">Alarms</label>
<select id="@FieldId("field-02")" class="form-select form-select-sm" @bind="_alarmScope" @bind:after="OnChangedAsync">
@foreach (var scope in FocasAddressBuilder.AlarmScopes)
{
<option value="@scope">@(scope == "*" ? "* (any on device)" : scope == "OTHER" ? "OTHER (unmatched)" : scope)</option>
@@ -47,13 +47,13 @@
@if (_alarmScope is not ("*" or "OTHER"))
{
<div class="col-md-3">
<label class="form-label">Number <span class="text-muted small">(optional)</span></label>
<input type="number" class="form-control form-control-sm" min="0" placeholder="any"
<label for="@FieldId("field-03")" class="form-label">Number <span class="text-muted small">(optional)</span></label>
<input id="@FieldId("field-03")" type="number" class="form-control form-control-sm" min="0" placeholder="any"
@bind="_alarmLow" @bind:after="OnChangedAsync" />
</div>
<div class="col-md-3">
<label class="form-label">to <span class="text-muted small">(optional)</span></label>
<input type="number" class="form-control form-control-sm" min="0" placeholder="single"
<label for="@FieldId("field-04")" class="form-label">Through number <span class="text-muted small">(optional)</span></label>
<input id="@FieldId("field-04")" type="number" class="form-control form-control-sm" min="0" placeholder="single"
@bind="_alarmHigh" @bind:after="OnChangedAsync" />
</div>
}
@@ -65,8 +65,8 @@
else if (_kind == FocasManualAddressKind.Pmc)
{
<div class="col-md-2">
<label class="form-label">Area</label>
<select class="form-select form-select-sm" @bind="_pmcLetter" @bind:after="OnChangedAsync">
<label for="@FieldId("field-05")" class="form-label">Area</label>
<select id="@FieldId("field-05")" class="form-select form-select-sm" @bind="_pmcLetter" @bind:after="OnChangedAsync">
@foreach (var letter in FocasAddressBuilder.PmcLetters)
{
<option value="@letter">@letter</option>
@@ -77,18 +77,18 @@
@if (_kind != FocasManualAddressKind.Alarm)
{
<div class="col-md-3">
<label class="form-label">@(_kind == FocasManualAddressKind.Pmc ? "Byte" : "Number")</label>
<input type="number" class="form-control form-control-sm" min="0"
<label for="@FieldId("field-06")" class="form-label">@(_kind == FocasManualAddressKind.Pmc ? "Byte" : "Number")</label>
<input id="@FieldId("field-06")" type="number" class="form-control form-control-sm" min="0"
@bind="_number" @bind:after="OnChangedAsync" />
</div>
}
@if (_kind is not (FocasManualAddressKind.Macro or FocasManualAddressKind.Alarm))
{
<div class="col-md-3">
<label class="form-label">
<label for="@FieldId("field-07")" class="form-label">
Bit <span class="text-muted small">(optional, @(_kind == FocasManualAddressKind.Pmc ? "0-7" : "0-31"))</span>
</label>
<input type="number" class="form-control form-control-sm" min="0"
<input id="@FieldId("field-07")" type="number" class="form-control form-control-sm" min="0"
max="@(_kind == FocasManualAddressKind.Pmc ? 7 : 31)"
placeholder="whole word"
@bind="_bitIndex" @bind:after="OnChangedAsync" />
@@ -147,6 +147,9 @@
</div>
@code {
private readonly string _fieldScope = "f-o-c-a-s-address-picker-body-" + Guid.NewGuid().ToString("N");
private string FieldId(string name) => $"{_fieldScope}-{name}";
[Parameter] public string CurrentAddress { get; set; } = "";
[Parameter] public EventCallback<string> CurrentAddressChanged { get; set; }
/// <summary>Driver type used to open a universal browse session (defaults to FOCAS).</summary>
@@ -13,16 +13,16 @@
<div class="row g-3">
<div class="col-md-5">
<label class="form-label">Tag name</label>
<input type="text" class="form-control form-control-sm mono" placeholder="DelmiaReceiver_001"
<label for="@FieldId("field-01")" class="form-label">Tag name</label>
<input aria-describedby="@FieldIds("field-01-hint")" id="@FieldId("field-01")" type="text" class="form-control form-control-sm mono" placeholder="DelmiaReceiver_001"
@bind="_tagName" @bind:after="OnManualChangedAsync" />
<div class="form-text">Globally unique system (tag) name.</div>
<div id="@FieldId("field-01-hint")" class="form-text">Globally unique system (tag) name.</div>
</div>
<div class="col-md-5">
<label class="form-label">Attribute name</label>
<input type="text" class="form-control form-control-sm mono" placeholder="DownloadPath"
<label for="@FieldId("field-02")" class="form-label">Attribute name</label>
<input aria-describedby="@FieldIds("field-02-hint")" id="@FieldId("field-02")" type="text" class="form-control form-control-sm mono" placeholder="DownloadPath"
@bind="_attributeName" @bind:after="OnManualChangedAsync" />
<div class="form-text">MXAccess attribute name.</div>
<div id="@FieldId("field-02-hint")" class="form-text">MXAccess attribute name.</div>
</div>
</div>
@@ -96,6 +96,10 @@
</div>
@code {
private readonly string _fieldScope = "galaxy-address-picker-body-" + Guid.NewGuid().ToString("N");
private string FieldIds(params string[] names) => string.Join(" ", names.Select(FieldId));
private string FieldId(string name) => $"{_fieldScope}-{name}";
[Parameter] public string CurrentAddress { get; set; } = "";
[Parameter] public EventCallback<string> CurrentAddressChanged { get; set; }
[Parameter, EditorRequired] public Func<string> GetConfigJson { get; set; } = () => "{}";
@@ -11,11 +11,11 @@
<div class="row g-3">
<div class="col-md-10">
<label class="form-label">NodeId</label>
<input type="text" class="form-control form-control-sm mono"
<label for="@FieldId("field-01")" class="form-label">NodeId</label>
<input aria-describedby="@FieldIds("field-01-hint")" id="@FieldId("field-01")" type="text" class="form-control form-control-sm mono"
placeholder="ns=2;s=Channel.Device.Tag"
@bind="_nodeId" @bind:after="OnChangedAsync" />
<div class="form-text">
<div id="@FieldId("field-01-hint")" class="form-text">
OPC UA NodeId string, e.g. <code>ns=2;s=Channel.Device.Tag</code> or
<code>i=1001</code>. Use Browse to navigate the remote server.
</div>
@@ -58,6 +58,10 @@
</div>
@code {
private readonly string _fieldScope = "opc-ua-client-address-picker-body-" + Guid.NewGuid().ToString("N");
private string FieldIds(params string[] names) => string.Join(" ", names.Select(FieldId));
private string FieldId(string name) => $"{_fieldScope}-{name}";
[Parameter] public string CurrentAddress { get; set; } = "";
[Parameter] public EventCallback<string> CurrentAddressChanged { get; set; }
[Parameter, EditorRequired] public Func<string> GetConfigJson { get; set; } = () => "{}";
@@ -26,31 +26,31 @@
<div class="row g-3">
<div class="col-md-4">
<label class="form-label">Model</label>
<select class="form-select form-select-sm" @bind="_model" @bind:after="OnManualChangedAsync">
<label for="@FieldId("field-01")" class="form-label">Model</label>
<select aria-describedby="@FieldIds("field-01-hint")" id="@FieldId("field-01")" class="form-select form-select-sm" @bind="_model" @bind:after="OnManualChangedAsync">
<option value="KeyValue">KeyValue</option>
<option value="WideRow">WideRow</option>
</select>
<div class="form-text">
<div id="@FieldId("field-01-hint")" class="form-text">
KeyValue: one row per key. WideRow: many columns of one selected row.
</div>
</div>
<div class="col-md-5">
<label class="form-label">Table or view</label>
<input type="text" class="form-control form-control-sm mono" placeholder="dbo.TagValues"
<label for="@FieldId("field-02")" class="form-label">Table or view</label>
<input aria-describedby="@FieldIds("field-02-hint")" id="@FieldId("field-02")" type="text" class="form-control form-control-sm mono" placeholder="dbo.TagValues"
@bind="_table" @bind:after="OnManualChangedAsync" />
<div class="form-text">Schema-qualified, e.g. <code>dbo.TagValues</code>.</div>
<div id="@FieldId("field-02-hint")" class="form-text">Schema-qualified, e.g. <code>dbo.TagValues</code>.</div>
</div>
<div class="col-md-3">
<label class="form-label">Type</label>
<select class="form-select form-select-sm" @bind="_type" @bind:after="OnManualChangedAsync">
<label for="@FieldId("field-03")" class="form-label">Type</label>
<select aria-describedby="@FieldIds("field-03-hint")" id="@FieldId("field-03")" class="form-select form-select-sm" @bind="_type" @bind:after="OnManualChangedAsync">
<option value="">(infer)</option>
@foreach (var t in Enum.GetValues<DriverDataType>())
{
<option value="@t">@t</option>
}
</select>
<div class="form-text">Blank ⇒ inferred from the column.</div>
<div id="@FieldId("field-03-hint")" class="form-text">Blank ⇒ inferred from the column.</div>
</div>
</div>
@@ -58,19 +58,19 @@
{
<div class="row g-3 mt-1">
<div class="col-md-4">
<label class="form-label">Key column</label>
<input type="text" class="form-control form-control-sm mono" placeholder="tag_name"
<label for="@FieldId("field-04")" class="form-label">Key column</label>
<input id="@FieldId("field-04")" type="text" class="form-control form-control-sm mono" placeholder="tag_name"
@bind="_keyColumn" @bind:after="OnManualChangedAsync" />
</div>
<div class="col-md-4">
<label class="form-label">Key value</label>
<input type="text" class="form-control form-control-sm mono" placeholder="Line1.Speed"
<label for="@FieldId("field-05")" class="form-label">Key value</label>
<input aria-describedby="@FieldIds("field-05-hint")" id="@FieldId("field-05")" type="text" class="form-control form-control-sm mono" placeholder="Line1.Speed"
@bind="_keyValue" @bind:after="OnManualChangedAsync" />
<div class="form-text">Bound as a parameter — never interpolated.</div>
<div id="@FieldId("field-05-hint")" class="form-text">Bound as a parameter — never interpolated.</div>
</div>
<div class="col-md-4">
<label class="form-label">Value column</label>
<input type="text" class="form-control form-control-sm mono" placeholder="num_value"
<label for="@FieldId("field-06")" class="form-label">Value column</label>
<input id="@FieldId("field-06")" type="text" class="form-control form-control-sm mono" placeholder="num_value"
@bind="_valueColumn" @bind:after="OnManualChangedAsync" />
</div>
</div>
@@ -79,14 +79,14 @@ else
{
<div class="row g-3 mt-1">
<div class="col-md-4">
<label class="form-label">Value column</label>
<input type="text" class="form-control form-control-sm mono" placeholder="oven_temp"
<label for="@FieldId("field-07")" class="form-label">Value column</label>
<input aria-describedby="@FieldIds("field-07-hint")" id="@FieldId("field-07")" type="text" class="form-control form-control-sm mono" placeholder="oven_temp"
@bind="_columnName" @bind:after="OnManualChangedAsync" />
<div class="form-text">The column this tag reads from the selected row.</div>
<div id="@FieldId("field-07-hint")" class="form-text">The column this tag reads from the selected row.</div>
</div>
<div class="col-md-4">
<label class="form-label">Row selector</label>
<select class="form-select form-select-sm" @bind="_selectorMode" @bind:after="OnManualChangedAsync">
<label for="@FieldId("field-08")" class="form-label">Row selector</label>
<select id="@FieldId("field-08")" class="form-select form-select-sm" @bind="_selectorMode" @bind:after="OnManualChangedAsync">
<option value="Where">Where column = value</option>
<option value="Newest">Newest by timestamp</option>
</select>
@@ -94,21 +94,21 @@ else
@if (_selectorMode == "Where")
{
<div class="col-md-2">
<label class="form-label">Where column</label>
<input type="text" class="form-control form-control-sm mono" placeholder="station_id"
<label for="@FieldId("field-09")" class="form-label">Where column</label>
<input id="@FieldId("field-09")" type="text" class="form-control form-control-sm mono" placeholder="station_id"
@bind="_whereColumn" @bind:after="OnManualChangedAsync" />
</div>
<div class="col-md-2">
<label class="form-label">Where value</label>
<input type="text" class="form-control form-control-sm mono" placeholder="7"
<label for="@FieldId("field-10")" class="form-label">Where value</label>
<input id="@FieldId("field-10")" type="text" class="form-control form-control-sm mono" placeholder="7"
@bind="_whereValue" @bind:after="OnManualChangedAsync" />
</div>
}
else
{
<div class="col-md-4">
<label class="form-label">Order-by (timestamp) column</label>
<input type="text" class="form-control form-control-sm mono" placeholder="sample_ts"
<label for="@FieldId("field-11")" class="form-label">Order-by (timestamp) column</label>
<input id="@FieldId("field-11")" type="text" class="form-control form-control-sm mono" placeholder="sample_ts"
@bind="_topByTimestamp" @bind:after="OnManualChangedAsync" />
</div>
}
@@ -117,10 +117,10 @@ else
<div class="row g-3 mt-1">
<div class="col-md-6">
<label class="form-label">Timestamp column <span class="text-muted small">(optional)</span></label>
<input type="text" class="form-control form-control-sm mono" placeholder="sample_ts"
<label for="@FieldId("field-12")" class="form-label">Timestamp column <span class="text-muted small">(optional)</span></label>
<input aria-describedby="@FieldIds("field-12-hint")" id="@FieldId("field-12")" type="text" class="form-control form-control-sm mono" placeholder="sample_ts"
@bind="_timestampColumn" @bind:after="OnManualChangedAsync" />
<div class="form-text">Source-timestamp column; blank ⇒ the driver stamps the poll time.</div>
<div id="@FieldId("field-12-hint")" class="form-text">Source-timestamp column; blank ⇒ the driver stamps the poll time.</div>
</div>
</div>
@@ -129,11 +129,11 @@ else
<hr class="my-3" />
<div class="row g-3">
<div class="col-md-12">
<label class="form-label small">Ad-hoc connection string <span class="text-muted">(session-only, never saved)</span></label>
<input type="password" class="form-control form-control-sm mono" autocomplete="off"
<label for="@FieldId("field-13")" class="form-label small">Ad-hoc connection string <span class="text-muted">(session-only, never saved)</span></label>
<input aria-describedby="@FieldIds("field-13-hint")" id="@FieldId("field-13")" type="password" class="form-control form-control-sm mono" autocomplete="off"
placeholder="Server=…;Database=…;User Id=…;Password=…"
@bind="_adhocConnectionString" />
<div class="form-text">
<div id="@FieldId("field-13-hint")" class="form-text">
Leave blank to browse via the driver's <code>connectionStringRef</code> (resolved from
the AdminUI host's <code>Sql__ConnectionStrings__&lt;ref&gt;</code> env var). Paste a
literal only for a one-off browse — it is used for this session and never persisted.
@@ -209,6 +209,10 @@ else
</div>
@code {
private readonly string _fieldScope = "sql-address-picker-body-" + Guid.NewGuid().ToString("N");
private string FieldIds(params string[] names) => string.Join(" ", names.Select(FieldId));
private string FieldId(string name) => $"{_fieldScope}-{name}";
[Parameter] public string CurrentAddress { get; set; } = "";
[Parameter] public EventCallback<string> CurrentAddressChanged { get; set; }
@@ -12,10 +12,10 @@
<div class="row g-3">
<div class="col-md-8">
<label class="form-label">ADS variable name</label>
<input type="text" class="form-control form-control-sm mono" placeholder="MAIN.fValue"
<label for="@FieldId("field-01")" class="form-label">ADS variable name</label>
<input aria-describedby="@FieldIds("field-01-hint")" id="@FieldId("field-01")" type="text" class="form-control form-control-sm mono" placeholder="MAIN.fValue"
@bind="_varName" @bind:after="OnChangedAsync" />
<div class="form-text">
<div id="@FieldId("field-01-hint")" class="form-text">
Full ADS symbol path, e.g. <code>MAIN.fValue</code> or <code>GVL.iCounter</code>.
</div>
</div>
@@ -65,6 +65,10 @@
</div>
@code {
private readonly string _fieldScope = "twin-c-a-t-address-picker-body-" + Guid.NewGuid().ToString("N");
private string FieldIds(params string[] names) => string.Join(" ", names.Select(FieldId));
private string FieldId(string name) => $"{_fieldScope}-{name}";
[Parameter] public string CurrentAddress { get; set; } = "";
[Parameter] public EventCallback<string> CurrentAddressChanged { get; set; }
/// <summary>Driver type used to open a universal browse session (defaults to TwinCAT).</summary>