Skip to content

Replace hardcoded inline styles with USWDS utility classes #13

Description

@mryhmln

Note: Moved from #27. Not yet committed to doing this — preserved for future consideration.

Summary

The harness engine components use hardcoded hex colors and inline styles throughout instead of USWDS design tokens and utility classes. This creates accessibility risk (unverified contrast ratios) and inconsistency with the design system.

Files affected

  • packages/harness/src/engine/ComponentMapper.tsx — program annotation badges use hardcoded colors (#e1f3f8, #0d47a1, #fce4ec, #b71c1c); new "Modified" badge uses inline backgroundColor: '#005ea2' instead of bg-primary text-white
  • packages/harness/src/engine/FieldArrayRenderer.tsxunstyled Remove button with only color: '#d83933' (no aria-label, loses USWDS focus ring); fieldset/row borders use hardcoded #dfe1e2, #e6e6e6
  • packages/harness/src/engine/FormRenderer.tsx — programs callout box is a plain <div> with #f0f0f0 background, no semantic role
  • packages/harness/src/engine/SplitPanelRenderer.tsx — inline CSS Grid instead of USWDS grid-row/grid-col-6; panel headers use hardcoded #005ea2 border and #1b1b1b text

What to fix

  1. Replace all hardcoded hex colors with USWDS utility classes (e.g. bg-primary, text-white, border-base-lighter)
  2. Use USWDS grid system (grid-row, grid-col-6) instead of inline CSS Grid
  3. Add aria-label to FieldArrayRenderer Remove button (e.g. "Remove row 2")
  4. Give the programs callout box a semantic role (role="region" with aria-label, or use USWDS Alert)
  5. Verify color contrast ratios meet WCAG 2.1 AA (4.5:1 for normal text)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions