Skip to content

fix(analyzers): don't flag string-typed Button labels in REACTOR_A11Y_001 - #1427

Merged
Alexandre Zollinger Chohfi (azchohfi) merged 3 commits into
microsoft:mainfrom
bkudiess:bkudiess-fix-a11y001-string-label
Oct 27, 2026
Merged

Alexandre Zollinger Chohfi (azchohfi) merged 3 commits into
microsoft:mainfrom
bkudiess:bkudiess-fix-a11y001-string-label

Conversation

@bkudiess

@bkudiess Barbara Kudiess (bkudiess) commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Summary

REACTOR_A11Y_001 (IconButtonAccessibilityAnalyzer) treated every Button(label, onClick) whose first argument was not a string literal as icon-only and demanded .AutomationName(...). Text buttons with a localized or computed label are false positives, because their text content already provides the accessible name:

Button(S("Usage_Refresh"), controller.Refresh);   // resource lookup → was flagged
Button(label, onClick);                            // string variable → was flagged
Button($"Retry ({n})", onClick);                   // interpolated   → was flagged
Button(localizedString, onClick);                  // type with implicit string conversion → was flagged

We found this in an app where all UI copy comes from .resw resources, so every text button reported the warning.

Fix: after the existing cheap syntactic filters (factory name, arity, literal check, .AutomationName chain walk), the analyzer asks the semantic model about the first argument. If its type, or the type it is converted to, is string, the call binds to Button(string, ...) and is a text button, so the analyzer skips it. Element or icon content such as Button(icon, ...) or Button(TextBlock("🗑"), ...) still reports. The analyzer stays netstandard2.0-safe.

The guide's mirrored a11y-rule snippet (analyzer-architecture) has been regenerated, and CHANGELOG.md has a Fixed entry. The diagnostic id is unchanged, so AnalyzerReleases doesn't change. mur check has no A11Y_001 rule to keep in sync; CheckCommand.cs only maps the id to a help link.

Linked issue / spec

Part of spec docs/specs/006-accessibility-design.md §6.3 (Roslyn analyzer). No issue filed.

Test plan

  • Added analyzer unit tests in tests/Reactor.Tests/AnalyzerTests/AccessibilityAnalyzerTests.cs:
    • a localized/variable string label produces no diagnostic;
    • element content still produces a diagnostic;
    • the real Button(string) / Button(Element) overloads with an implicit-to-string label type: text cases produce no diagnostic and the Element case reports.
  • dotnet test tests/Reactor.Tests --no-build -p:Platform=x64 --filter-class "*AccessibilityAnalyzer*": passed, 9/9.
  • dotnet test tests/Reactor.Tests --no-build -p:Platform=x64 --filter "FullyQualifiedName~AnalyzerTests": passed, 3190/3190.
  • Mutation checks: with the string-type early return removed, the localized-label test fails. With only the ConvertedType check removed, the overload-set test fails. Both pass once the code is restored.
  • dotnet build src/Reactor.Analyzers -c Release: 0 warnings, 0 errors.
  • dotnet run --project tools/Reactor.DocPipeline -- compile --topic analyzer-architecture --skip-screenshots --skip-diagrams: succeeded. The guide diff is limited to the snippet and one prose sentence.
  • dotnet run --project tools/Reactor.DocPipeline -- check-tier --topic analyzer-architecture: 0 errors, plus one pre-existing non-fatal REACTOR_DOC_TIER_W001 warning.
  • CI on ee0a7142: 42/42 check runs completed. 40 succeeded, including Build solution (Release), Unit Tests, Selftests, Packaged and AOT selftests, E2E, Integration and Coverage. 2 were path-filtered skips (Audit ledger gate, Devtools trim mstat).
  • I didn't run the full-solution dotnet build Reactor.slnx --no-restore -c Release locally. The CI Build solution job covers it and passed.

Risk / breaking changes

The analyzer now reports fewer warnings, never new ones, so projects with WarningsAsErrors for A11Y_001 can only see fewer errors. There's no public API change. The semantic lookup runs only after the syntactic filters, so it adds little cost.

Known limit: an icon-glyph or emoji label passed as a string constant or variable, such as Button(Glyphs.Delete, f), is now skipped. Glyph string literals like Button("✕", f) were already skipped. The runtime AccessibilityScanner A11Y_001 check still flags empty, whitespace and emoji-like labels. Arguments named out of order (Button(onClick: f, label: x)) are still read positionally, as before this PR.

…_001

Button(S("Usage_Refresh"), onClick) and other non-literal string labels
(resource lookups, variables, interpolated strings) are text buttons whose
content provides the accessible name. IconButtonAccessibilityAnalyzer now
skips a first argument whose semantic type is System.String; element/icon
content still reports.

Co-authored-by: Copilot App <[email protected]>
Also skip labels whose ConvertedType is string (a label type with an
implicit conversion to string binds to the Button(string, ...) overload),
add a test modelling the real Button(string)/Button(Element) overload set,
regenerate the analyzer-architecture snippet, and note in the CHANGELOG that
glyph/emoji strings stay with the runtime AccessibilityScanner.

Co-authored-by: Copilot App <[email protected]>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues remain for the analyzer’s string-label detection change.

No open issues 🎉

What changed in this PR

This PR reduces false positives in Reactor’s REACTOR_A11Y_001 accessibility analyzer by recognizing non-literal string labels as text-button content.

Changes:

  • Uses semantic type information to recognize string labels and expressions converted to string, while retaining diagnostics for element/icon content.
  • Adds regression tests for localized labels, string variables, implicit conversions, and overload selection.
  • Updates the analyzer guide and changelog to describe the behavior.
File Description
tests/​Reactor.Tests/​AnalyzerTests/​AccessibilityAnalyzerTests.cs Adds text-label and element-content regression tests.
src/​Reactor.Analyzers/​AccessibilityAnalyzers.cs Adds semantic string-type checks before reporting diagnostics.
docs/​guide/​analyzer-architecture.md Updates the generated snippet and explanation.
docs/​_pipeline/​templates/​analyzer-architecture.md.dt Documents semantic label detection in the guide source.
CHANGELOG.md Records the accessibility analyzer fix and glyph-string limitation.

Review effort: Balanced

@azchohfi
Alexandre Zollinger Chohfi (azchohfi) merged commit f92623b into microsoft:main Oct 27, 2026
29 checks passed
Barbara Kudiess (bkudiess) added a commit to openclaw/openclaw-windows-node that referenced this pull request Nov 10, 2026
…rts and filters (#1895)

* feat(usage): rebuild the Usage page with the web page's sessions, charts and filters

Replace the classic XAML Usage page with a Reactor page that gives Windows
users the same usage information as the web Control UI: reporting range with
presets, time zone and scope, totals, daily token and cost charts, started-by
attribution, overview stats and top lists, cost windows, heatmap, activity by
time, a sessions list with per-session details, provider plans, and CSV/JSON
export.

Gateway JSON is parsed in OpenClaw.Shared (sessions.usage, .timeseries, .logs,
usage.status, usage.cost) and projected by WinUI-free presentation code with
unit tests. Released Gateways that reject the newer sessions.usage overview
parameters get a basic view; Gateways without sessions.usage fall back to
usage.cost totals.

Depends on Reactor analyzer fixes microsoft/microsoft-ui-reactor#1427 and
microsoft/microsoft-ui-reactor#1428; with stock 0.1.0-preview.12 the build
reports 7 REACTOR_DSL_001/REACTOR_A11Y_001 false positives.

Co-authored-by: Copilot App <[email protected]>

* fix(usage): keep chart marks visible in high contrast

Use the existing Usage data palette for marks and selection indicators instead of the native button fill, which can equal the plot background in high contrast. Cover clickable and nonclickable native charts with contrasting theme inputs.

Co-authored-by: Copilot App <[email protected]>

* fix(usage): preserve filtered and incomplete report states

Keep filtered details scoped to matching usage, preserve model lower bounds, clear unsupported legacy selection and show legacy refresh failures. Pair high-contrast weekday text and fill, and strengthen callback and production-theme regression coverage.

Co-authored-by: Copilot App <[email protected]>

* feat(usage): compact native Usage page on official Reactor preview.17

Replace the classic XAML Usage page with a compact Reactor page backed by
read-only Gateway reads.

- Cost, token and session totals; Today, 7-day, 30-day and custom ranges with a
  visible reporting zone; a daily trend with an accessible table; agent, model
  and provider contributors; capability-gated session browsing; lightweight
  detail; native conversation access; a web Usage handoff and a secondary CSV
  export.
- Provider allowance stays distinct from session-derived estimates. Partial,
  stale, failed, unsupported, forbidden and disconnected states are explicit.
- Released Gateways that reject the server overview parameters get a bounded
  basic view (at most 1000 rows). Older Gateways report Unsupported.
- Compact header: short custom-range label and inline date pickers on wide
  hosts, using the shared PageResponsiveLayout helper.
- Adopt official Reactor 0.1.0-preview.17 with a hash-verified, repository-local
  package bootstrap wired into build, CI, CodeQL and Store packaging.
- Update the six locales, DESIGN.md palette resources, the architecture ledger
  and the fixture documentation.

Known open items: the mounted UsagePageRenderingTests 937.14 DIP compact
transition case still fails, and cached Usage state is not yet reset when the
operator Gateway client changes.

Co-authored-by: Copilot App <[email protected]>

* fix(usage): reset Usage on Gateway switch and stabilize layout waits

- Drop reports, plans, details and export state from the previous Gateway
  when the operator client is replaced; keep range, zone, scope, search,
  sort and metric. In-flight reads are cancelled and generation-fenced.
- Read the operator client once per operation so a replacement between
  reads cannot split one load across two Gateways or send the previous
  Gateway's session key to the new one.
- UI tests: wait on physical-pixel width for the 937.14 DIP transition
  and on model/topology convergence for the Custom range reflow.

Co-authored-by: Copilot App <[email protected]>

* fix(usage): preserve native analysis and shared inset geometry

Keep reported-day charts, native expanders and shared provider reads. Integrate the authorized adaptive Settings and embedded inset/toggle ownership ports, and add pinned Usage hit, keyboard and feedback proof coverage.

Current source-only shell/test additions remain unvalidated pending the exclusive native lane. Historical proof does not establish acceptance of this candidate.

Co-authored-by: Copilot App <[email protected]>

* fix(usage): refine native hero, facts and rendering diagnostics

Keep compact usage facts responsive, localize the allowance warning, and add owned-window paired capture diagnostics. Native pixel proof remains pending.

Co-authored-by: Copilot App <[email protected]>

* fix(usage): simplify native controls and polish session layout

Co-authored-by: Copilot App <[email protected]>

* fix(usage): address analysis correctness and review regressions

Preserve query provenance, disclose bounded selected-session details, keep pricing completeness separate from token counts, and coordinate provider refresh after authenticated binding. Bootstrap published Reactor packages before local builds while preserving NoBuild; adopt shared capped-field alignment and focused regressions.

Validated source content in an isolated headless snapshot: full build passed; Shared 4909 passed with 25 permitted skips; unfiltered Tray 5557 passed; Debug ARM64 UI tests compiled with no warnings or errors; documentation and 20 offline bootstrap controls passed.

Native/UI and Debug/non-Dev Release real-app proof remain blocked. The earlier failed run and retained safety lease are unchanged. No native readiness claim is made.

Co-authored-by: Copilot App <[email protected]>

* fix(usage): fence deferred exports and stale analysis warnings

Check Gateway and page ownership after native file selection, withhold exact session shares for incomplete reports, and share expiry-aware provider attention. Preserve later reset notifications and retained-snapshot render invalidation.

Add deferred-file, completeness, provider lifetime and rendered regressions. Repair deterministic Usage fixture coverage and native geometry proof boundaries without removing keyboard, hit-testing, inset or ink assertions. Retain the unassigned mounted testhost crash as a validation blocker.

Validation: diff checks and static fixture reproduction passed. Independent source/proof-plan review completed; both follow-up test findings were corrected and independently checked. Windows build, .NET tests, negative controls and native proof remain unrun here because pwsh, dotnet and winapp are unavailable.

Co-authored-by: bkudiess <[email protected]>

* fix(usage): distinguish quota-window projection from WinUI types

Rename only the private LINQ tuple member so the unchanged pure-presentation architecture guard does not mistake it for a WinUI Window. Filtering and ordering are byte-identical after normalizing that identifier.

Validation: baseline/candidate token check and git diff --check passed. Full build, Shared/Tray and focused xUnit execution remain blocked locally by missing PowerShell and dotnet; fresh CI and native validation are required.

Co-authored-by: bkudiess <[email protected]>

* fix(usage): wait for committed warnings and unobstructed proof

Keep the failure-detail assertion behind actual native warning layout rather than unchanged fallback text. Prepare each responsive capture through the known host-warning presentation control, retain its Inbox fact, and reject late or unknown notification obstruction without weakening ink or hit-test guards.

Validation: diff checks and independent source/rubber-duck review completed, including corrections for capture-window ownership and asynchronous warning admission. Windows build and Shared/Tray tests remain unrun locally because pwsh and dotnet are unavailable. Preserve the original failed UI run, shared pane-toggle failure and whole-fixture timeout as outstanding validation work.

Co-authored-by: bkudiess <[email protected]>

* fix(usage): await measurable peers during responsive proof

Treat temporarily missing UI Automation measurements as not ready while retaining consecutive stable widths, exact geometry, all five captures and foreground ink checks. Keep this repair based on the published head, separate from private native height diagnostics.

Co-authored-by: bkudiess <[email protected]>

* test(chat): await composer visibility commits around questions

Observe the root visibility commit as well as the independently rendered question controls. Preserve native control identity, view-model draft and visibility assertions, and verify native draft text while hidden.

Co-authored-by: bkudiess <[email protected]>

* test(usage): verify native filter alignment rather than equal heights

Respect content-sized native controls while checking row containment, desired-height allocation, wide center alignment and wrapped query separation. Preserve the six theme/width cases and native session action guards.

Co-authored-by: bkudiess <[email protected]>

* test(chat): retain bounded redirect probe diagnostics

Record content-free monotonic phases and responder outcomes without changing the production request, security assertions or timeout budgets. Preserve primary failures and observe responder faults across cleanup races. This collects evidence, not a fix for the retained timeout.

Co-authored-by: bkudiess <[email protected]>

* fix(usage): retain query recovery and prove physical pane input

Keep overview-capable search mounted while a new query loads or fails, without restoring stale figures. Cover retained native focus and recovery through a bounded committed-state wait.

Replace the PR-added UIA point-leaf assumption with exact-center native mouse input and required pane transitions. Record the original UIA bridge result, require exact root HWND and foreground ownership, and reject a real test-owned opaque occluder. Preserve geometry and Tab assertions with no Invoke fallback.

Full isolated build, Shared (5347 passed, 28 permitted skips), Tray (5797 passed), native compilation and docs/bootstrap checks passed on the repair candidate. Final Release query regression passed. Debug and Release pinned fixtures proved physical transitions and occluder rejection, then failed the retained Tab-to-content assertion; attribution remains inconclusive and that gate is not waived. Earlier failed attempts remain recorded.

Co-authored-by: Copilot App <[email protected]>

* refactor(usage): trim unrelated and unused page machinery

Preserve the approved daily analysis, connection and generation fencing, capability fallback, query recovery, export safeguards and distinct native regressions. Remove unrelated chat/Inbox changes, unused count state and forwarding, web-only fixture analytics, orphan resources and duplicate cases.

Validated exact tree aa2374d: full build; Shared 5347 passed with 28 permitted skips; unfiltered Tray 5828 passed; focused suites 175 and 246 passed; ARM64 UI compilation and docs/skills/bootstrap checks passed. Native runtime proof remains separate.

Co-authored-by: Copilot App <[email protected]>

* test(usage): follow native title-bar tab order in pinned proof

Preserve physical hit and occlusion checks, then assert exact native title-bar stops before visible page focus. Verify Shift+Tab leaves content and Tab returns to the same control. The prior direct history-to-content assertion contradicted unchanged main XAML order.

Validated final source with full build, Shared 5445 passed/28 permitted skips, unfiltered Tray 5993 passed, focused 177/246, UI/integration compilation and workflow/docs checks. The exact pinned fixture passed 1/1 across Light and Dark with 20 physical transitions, two occluder negatives and explicit forward/reverse focus receipts; owned kernel job drained before release.

Co-authored-by: Copilot App <[email protected]>

---------

Co-authored-by: Copilot App <[email protected]>
Co-authored-by: roboclaw-bot <[email protected]>
Co-authored-by: bkudiess <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants