Skip to content

fix(mapgen-studio): split field label to foreground tier and gate error live regions on rawErrors#1620

Merged
mateicanavra merged 1 commit into
mainfrom
design/form-hierarchy
Jun 12, 2026
Merged

fix(mapgen-studio): split field label to foreground tier and gate error live regions on rawErrors#1620
mateicanavra merged 1 commit into
mainfrom
design/form-hierarchy

Conversation

@mateicanavra

Copy link
Copy Markdown
Owner

Fix phantom alert regions and establish label/description visual hierarchy in the config form

Problem 1 — 40 empty role="alert" regions on a pristine form

rjsf's errors prop is an always-truthy ReactElement, so the previous guard ({errors ? … }) mounted a live region for every field regardless of whether any validation had failed. Screen readers were announcing ~40 orphaned alert regions on load. The template now reads rawErrors (the actual string array) and only mounts the role="alert" div when rawErrors.length > 0, while still rendering the richer errors element inside it. The id="${id}__error" association contract used by widgets for aria-describedby/aria-invalid is preserved — the id appears exactly when the region exists.

Problem 2 — labels and descriptions were visually indistinguishable

Field labels and description/help/gs-comment prose were both rendered as 11px text-muted-foreground, giving the eye no anchor. A new FORM.fieldLabel token (text-foreground) is introduced for labels; descriptions, help text, and gs-comments remain on the muted tier. The split is color and weight only — no size or density change.

Scope note on hand-rolled fields

The task spec called for a matching split in src/ui/components/fields/styles.ts, but that file no longer exists — the legacy field set was removed in earlier theming work and only the layout-only FieldRow wrapper remains. No second label-styling site exists.

Tests

A new unit test (test/config/rjsfFieldTemplateErrors.test.tsx) covers three cases: no alert region on a pristine field, correct alert region and id when raw errors are present, and label on the foreground tier with description on the muted tier.

This was referenced Jun 12, 2026
@github-actions

Copy link
Copy Markdown

Railway preview (MapGen Studio): not provisioned for this PR.

Policy (Graphite stacks): previews are created only for the top-of-stack PR by default.

  • To force a preview for this PR: add label railway-preview
  • To suppress a preview: add label no-railway-preview

Debug: {"isClosed":false,"isFork":false,"suppress":false,"force":false,"isTopOfStack":false,"hasToken":true,"draft":false}

mateicanavra commented Jun 12, 2026

Copy link
Copy Markdown
Owner Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

mateicanavra commented Jun 12, 2026

Copy link
Copy Markdown
Owner Author

Merge activity

  • Jun 12, 8:50 PM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Jun 12, 9:23 PM UTC: Graphite rebased this pull request as part of a merge.
  • Jun 12, 9:23 PM UTC: @mateicanavra merged this pull request with Graphite.

@mateicanavra
mateicanavra changed the base branch from design/layout-geometry to graphite-base/1620 June 12, 2026 21:20
@mateicanavra
mateicanavra changed the base branch from graphite-base/1620 to main June 12, 2026 21:21
…ated alert regions

OpenSpec mapgen-studio-form-hierarchy. rjsf field labels move to the foreground
tier (descriptions/help stay muted; same 11px scale — contrast split, not size);
the per-field role=alert live region now mounts only when rawErrors exist,
killing the 40 phantom alert regions on a pristine form while preserving the
id__error association contract. New template unit test covers both paths.
Verified live: label rgb(232,232,237) vs prose rgb(143,143,153); alert count 0.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@mateicanavra
mateicanavra force-pushed the design/form-hierarchy branch from 5d05734 to d35b676 Compare June 12, 2026 21:22
@mateicanavra
mateicanavra merged commit d21476a into main Jun 12, 2026
1 check passed
This was referenced Jun 12, 2026
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.

1 participant