Skip to content

fix!: replace stale SLDS 1 design tokens with SLDS 2 styling hooks - #3250

Merged
Niznikr merged 2 commits into
masterfrom
fix/remove-stale-design-tokens
Oct 21, 2026
Merged

Niznikr merged 2 commits into
masterfrom
fix/remove-stale-design-tokens

Conversation

@Niznikr

@Niznikr Niznikr commented Oct 21, 2026

Copy link
Copy Markdown
Collaborator

Additional description

Root cause. utilities/design-tokens/dist/ was a copy of SLDS 1 token values taken in 2018 (4a44b8c). The build:design-tokens script that refreshed it no longer exists, so the values are older than current SLDS 1 and none of them reference an SLDS 2 hook. SimpleDataTable was the only consumer. In fixedHeader mode it writes the border (colorGray5, rgb(221, 219, 218)) and, with joined, the border radius (tableBorderRadius) as inline styles. Inline styles beat the stylesheet, so the border stayed SLDS 1 gray in Cosmos and dark mode. The audit lists this as "[MED] design-tokens/dist is a stale SLDS-1 vendored copy".

What changed

  • SimpleDataTable: the fixed-header border is 1px solid var(--slds-g-color-border-1), and the joined radius is 0 0 var(--slds-g-radius-border-2) var(--slds-g-radius-border-2). SLDS 2's own fixed-header and joined rules use these same hooks.
  • Deleted utilities/design-tokens/ (the README and 21 files). Only two of the files reached the published package.
  • Removed /design-tokens/ from the vite commonjsOptions.include, and its .prettierignore entry.
  • docs/codebase-overview.md now points contributors at var(--slds-g-*) hooks instead of at this utility.
  • 5 story snapshots updated. The only change is the inline style string.

BREAKING CHANGE. The deep imports …/utilities/design-tokens/dist/palette-colors.common and …/salesforce-skin.common are removed. They were never documented as API. To migrate, use var(--slds-g-*) hooks.

Expected Chromatic diffs

Theme Border before → after Joined radius before → after
Lightning Blue #dddbda → #c9c9c9 0.25rem → 0.25rem
Cosmos #dddbda → light-dark(#c9c9c9, #444) 0.25rem → 0.5rem

The stories to check are fixed header, fixed header with horizontal scrolling, and joined with page header, in light and dark. The legacy @salesforce-ux/design-system peer dependency doesn't define these hooks. That's expected: v11 is styled by design-system-2, and the peer dependency only supplies icons.

Out of scope: dropping the inline border and radius entirely (that needs its own visual review), and utilities/product-tokens/icon-backgrounds.js.

Verification: npm run test:ci passes. After a clean build, dist has no design-tokens directory and no rgb(221, 219, 218).

CONTRIBUTOR checklist (do not remove)

Please complete for every pull request.

Green gate — all of these must pass locally (CI runs the same):

  • npm run lint passes with 0 errors (npm run lint:fix to auto-fix). Warnings are the tracked gradual-migration backlog; do not add new errors.
  • npm run typecheck is clean (tsc --noEmit).
  • npm test -- --run passes — this runs both Vitest projects (jsdom unit + real-browser browser) and the story HTML snapshots. If you changed rendered markup on purpose, update snapshots with npm test -- --run -u and review the diff.
  • npm run build succeeds (type-check + Vite library build + .d.ts + entry shims).

Behavior & docs:

  • First-time contributors: sign the CLA (a bot will comment with instructions).
  • Added/updated Vitest + React Testing Library tests for the change (template: components/button/__tests__). New props and bug fixes should get a regression test. Tests that genuinely need a real browser (focus traversal, layout/measurement, canvas) go in a *.browser.test.jsx file (the browser project); everything else is jsdom.
  • Reviewed the component's Storybook stories: npm run storybook → http://localhost:6007/. Confirm the story actually renders and behaves (deprecated Storyshots/Karma are gone; there is no separate browser-tests server).
  • Story/example code uses the component's real prop API (e.g. render-props like onRenderContent / onRenderVisualPicker, icon props, events), not assumptions — a common source of "component looks broken" reports has been stories authored against the wrong API. Cross-check against components/<name>/__examples__.
  • Storybook Accessibility (a11y) panel shows no new violations for the affected stories.
  • If you added or changed a type, remember runtime PropTypes were removed in the TS migration — types are the contract. Ship accurate .d.ts (they're generated by the build); JS consumers rely on them via editor type-acquisition.

REVIEWER checklist (do not remove)

  • CI is green (GitHub Actions CI workflow: lint, typecheck, test, build). Chromatic visual review, if configured, has been checked.
  • Change has adequate test coverage; bug fixes include a regression test.
  • Reviewed the affected Storybook stories and their a11y panels.
  • Rendered markup still conforms to SLDS — check the story HTML snapshot diff (components/__tests__/__snapshots__/story-snapshots.test.jsx.snap).
  • Public API / package surface: if exports changed, the deep-import contract still holds (@salesforce/design-system-react/components/<name> and nested paths resolve for ESM, CJS, and types). Removing/renaming a public component or export is a breaking change → feat!:/BREAKING CHANGE: and a major version bump.

utilities/design-tokens/dist was a 2018 copy of SLDS 1 token values with
no way to regenerate it. Only SimpleDataTable used it, for the inline
fixed-header border (colorGray5) and joined border radius
(tableBorderRadius). Those inline values overrode SLDS 2 theming, so the
border stayed SLDS 1 gray in Cosmos and dark mode.

SimpleDataTable now uses --slds-g-color-border-1 and
--slds-g-radius-border-2. The utility folder, its vite commonjs include,
and its .prettierignore entry are removed, and the codebase overview
points contributors at var(--slds-g-*) hooks instead.

BREAKING CHANGE: the deep-import paths
utilities/design-tokens/dist/palette-colors.common and
utilities/design-tokens/dist/salesforce-skin.common are removed. Use SLDS 2
styling hooks (var(--slds-g-*)) instead.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Niznikr
Niznikr merged commit 14f382d into master Oct 21, 2026
10 checks passed
@Niznikr
Niznikr deleted the fix/remove-stale-design-tokens branch October 21, 2026 18:59
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