Skip to content

diagram: finish design-token consolidation (shadow tokens, px->rem typography, remaining hardcoded colors, toolbar-spacer token) #799

Closed

Description

@bpowers

Problem

A frontend UX audit (branch frontend-ux-audit-improvements) began a design-token consolidation but only finished part of it. The completed work added tokens to src/diagram/theme.css (--color-surface #fff, --color-border #ddd, --color-field-bg #f5f5f5, --shadow-sm/md/lg matching the three repeated MUI elevation triplets, --panel-top-inset, and the filled-in --spacing-4..-9 scale) and adopted them in the editor chrome (search bar; zoom/undo/snapshot cards; the three detail-panel cards) plus Button (contained), SpeedDial, Snackbar, Paper, and Card.

The audit rated the full sweep "large" and the remainder is untracked:

  1. Hardcoded colors not yet on tokens. ~a dozen components still hardcode #fff backgrounds, grey text (#666/#888/#999/#aaa/#333/#777), and dividers (#ddd/#eee/#ccc) instead of the theme.css tokens.

  2. Missing elevation-shadow tokens for the distinct MUI elevations. AppBar, Menu, Dialog, and Drawer use DISTINCT MUI elevation shadows (elevation 4/8/16/24) that have no token yet. Add --shadow-4/--shadow-8/etc. (or a renamed equivalent) and adopt them. (Note: --shadow-sm/md/lg from the done work only cover the three repeated elevation triplets, not these four distinct levels.)

  3. Raw-px text sizing inconsistent with the rem-based typography system. Editor chrome and detail panels size text in raw px (11/12/13/14/16px in Editor.module.css and ModuleDetails.module.css), so it does not honor user zoom. Add a caption typography variant (0.75rem) and convert these raw-px sizes to rem so they scale with user zoom.

  4. .toolbarSpacer hardcoded height coupled to the dense Toolbar. src/app/Home.module.css .toolbarSpacer is a hardcoded 48px coupled to the dense Toolbar height. It should derive from a shared --toolbar-dense-height token (or render an actual spacer Toolbar) so the two cannot drift apart.

Why it matters

Consistency and maintainability. Hardcoded literals scattered across components defeat the purpose of the token system, make global theme changes (and any future dark-mode work) error-prone, and let coupled values (like the toolbar spacer vs. dense toolbar height) silently drift. Raw-px text ignores user zoom, hurting accessibility. This is tech-debt / consistency cleanup, NOT a user-facing bug.

Components affected

  • src/diagram/theme.css (new elevation-shadow tokens, new caption typography variant)
  • src/diagram/components/*.module.css (the ~dozen components still hardcoding colors/dividers; AppBar, Menu, Dialog, Drawer for shadows)
  • src/diagram/.../Editor.module.css, ModuleDetails.module.css (raw-px -> rem)
  • src/app/Home.module.css (.toolbarSpacer -> shared dense-toolbar-height token)

Relationship to #709

Partially overlaps #709 (component-library CSS modules hardcode light colors with no dark-mode overrides) on the hardcoded-color sweep over src/diagram/components/*.module.css. #709 is framed as dark-mode parity (adopt the dark-aware tokens so dark mode stops rendering white boxes); this item is the broader audit remainder and additionally covers the elevation-shadow tokens, the px->rem typography conversion + caption variant, and the src/app toolbar-spacer coupling -- none of which #709 mentions. The color-sweep portions should be coordinated so they are done once.

How discovered

Identified during the frontend UX audit (frontend-ux-audit-improvements branch); the audit completed the token additions and editor-chrome/core-component adoption but rated the full sweep "large" and deferred the remainder enumerated above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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