Skip to content

fix: visual regressions - #3276

Merged
interactivellama merged 13 commits into
masterfrom
fix/slds2-visual-regressions
Nov 4, 2026
Merged

interactivellama merged 13 commits into
masterfrom
fix/slds2-visual-regressions

Conversation

@Niznikr

@Niznikr Niznikr commented Nov 2, 2026 •

Copy link
Copy Markdown
Collaborator

Additional description

Fixes visual regressions from the v11 rewrite, found by comparing every component against the pre-rewrite baseline (cce85579c) under both SLDS 1 and SLDS 2 (lightning-blue). Most of them have the same root cause: the markup depended on CSS that SLDS 1 ships and SLDS 2 doesn't. The rest are changes the rewrite made by accident. Each fix is a separate commit with a regression test and its own snapshot and CHANGELOG lines, so the PR can be reviewed one commit at a time.

Commit Symptom Root cause
fix(tree) Every leaf item, including selected ones, showed a chevron. Expanded branch chevrons didn't rotate under SLDS 1. Leaves render a disabled placeholder chevron to keep labels aligned. SLDS 1 hid it with a tree .slds-is-disabled rule that SLDS 2 doesn't have; it now gets slds-hidden. The rewrite also dropped aria-controls and aria-hidden from the branch toggle, and SLDS 1 only rotates the chevron when aria-controls is set.
fix(avatar) The fallback icon was the same size in every avatar size. SLDS 2 dropped the .slds-avatar_<size> .slds-icon rules. The Icon now gets the avatar's size.
fix(modal) Prompt modals showed a close button. Modal has always rendered the close button unless disableClose is set, and SLDS 1 hid it with .slds-modal_prompt .slds-modal__close { display: none }. SLDS 2 has no such rule, so prompts now skip the button.
fix(toast) ToastContainer and AlertContainer weren't fixed to the top of the viewport. The Toast close icon was smaller. SLDS 2 only styles slds-notify_container, not the hyphenated slds-notify-container the containers used. The rewrite had changed the close button from iconSize="large" to "medium".
fix(input) Clicking a decorative input icon didn't focus the input. SLDS 1's .slds-input-has-icon .slds-input__icon:not(button) { pointer-events: none } is gone in SLDS 2. The non-button InputIcon variants now set the style themselves.
fix(checkbox) The visual-picker variant drew a border and background around the whole picker. The label carried slds-checkbox_button__label, a class from the button-group variant. SLDS 1 only styled it inside .slds-checkbox_button; SLDS 2 styles it anywhere.
fix(welcome-mat) WelcomeMatInfoBadge's complete check was a large icon below the badge. SLDS 2 only sizes and positions the check inside a tile. The badge's check now gets the SLDS 1 geometry inline.
fix(menu-dropdown) TrialBarDropdown, and any MenuDropdown with a labelled icon Button trigger, lost its visible label. The dropdown passes assistiveText to the trigger Button, which renders icon-only when it has an icon and assistiveText.icon. A labelled child Button with no assistiveText of its own now clears the inherited icon text.
fix(accordion) Rendering an Accordion took focus from the page. The pre-rewrite focus logic lived in componentDidUpdate. The rewrite's useEffect also runs on mount.
fix(date-picker) dateDisabled handlers written against the type received an object, not a Date. The type was (date: Date) => boolean, but the calendar calls it with { date }. It is now ({ date }: { date: Date }) => boolean, with a type test.
docs: Several stories looked broken. The stories didn't use the real prop API: Spinner isInline, SetupAssistant progress, PageHeaderControl, BuilderHeader builderNav/toolbarButtonGroups, a list ButtonGroup in the Tooltip story, and the checkbox ButtonGroup example.
chore(eslint) Ignore the gitignored .planning/ scratch directory so local lint runs don't pick it up.

For the reviewer: dateDisabled type. TypeScript consumers who typed a handler as (date: Date) => boolean will now get a type error. Under the breaking-change taxonomy, a prop type change normally needs !. I left it as fix: because the old type never matched how the prop is called: those handlers received { date } and were already broken at runtime. Say if you'd rather mark it breaking.

Snapshot diff. All snapshot changes come from the fixes above: tree toggle attributes, notify container class, toast close icon class, input icon style, visual-picker label class, the TrialBar trigger label, and the corrected stories.

Not changed (SLDS 2 gaps, not component regressions):

  • SimpleDataTable stacked / stackedHorizontal: SLDS 2 doesn't ship stacked table styles, so these props only work under SLDS 1. The markup is the same as before the rewrite.
  • PillContainer pill focus: SLDS 2 has no .slds-pill:focus style, so a focused pill gets the browser's default focus ring. Focus is still visible.
  • The pre-rewrite Popover alignment stories (all 12 placements with hasStaticAlignment) weren't carried over. The current Alignments story is too cramped to show placement; that's for a follow-up.

Checked and found to match the baseline: ButtonStateful selected icons, focus stacking in checkbox and radio button groups, and Popover nubbin placement when the popover is shifted.


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. slots like content / visualPickerFigure, render props like renderItem, 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.

Niznikr and others added 12 commits November 2, 2026 12:21
Leaf items render a disabled placeholder chevron so their labels line
up with branch labels. SLDS 1 hid it with a tree rule for
`.slds-is-disabled` that SLDS 2 doesn't have, so every leaf, selected
ones included, showed a chevron. Add `slds-hidden` to the placeholder
and restore its `aria-hidden`.

The rewrite also dropped `aria-controls` and `aria-hidden` from the
branch toggle. SLDS 1 only rotates an expanded branch's chevron when
`aria-controls` is set, so the chevron stayed pointing right. Restore
both attributes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
SLDS 1 sized the fallback icon through `.slds-avatar_<size> .slds-icon`.
SLDS 2 dropped those rules, so the icon rendered at the default 2rem in
every avatar size. Pass the avatar's `size` to the Icon; the icon size
classes match the avatar sizes one to one.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Modal has always rendered the close button unless `disableClose` is
set. SLDS 1 hid it on prompts with `.slds-modal_prompt
.slds-modal__close { display: none }`, which SLDS 2 doesn't have, so
prompts showed a close button the SLDS prompt blueprint leaves out.
Skip the close button for prompts.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
ToastContainer and AlertContainer used the hyphenated
`slds-notify-container` class. SLDS 1 styled both spellings, but SLDS 2
only styles `slds-notify_container`, so the containers were no longer
fixed to the top of the viewport. Use the underscore class.

The rewrite also changed the Toast close button's `iconSize` from
`large` to `medium`. Restore `large`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
SLDS 1 set `pointer-events: none` on
`.slds-input-has-icon .slds-input__icon:not(button)`, so clicking a
decorative icon focused the input under it. SLDS 2 dropped the rule,
and the icon swallowed the click. Set the style on the non-button
InputIcon variants.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The visual-picker label carried `slds-checkbox_button__label`, a class
from the button-group variant. SLDS 1 only styled it inside
`.slds-checkbox_button`, but SLDS 2 styles it on its own, so it drew a
border and background around the whole picker. Remove it from the
visual-picker label.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
SLDS 1 sized and positioned the complete check for every welcome mat
check icon. SLDS 2 only does so inside a welcome mat tile, so the
badge's check rendered as a large icon below the badge. Give the
badge's check the SLDS 1 geometry with inline styles and an `xx-small`
icon. Its visibility still comes from
`.slds-welcome-mat__info-progress_complete`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The dropdown passes its `assistiveText` to the trigger Button, and
Button renders icon-only, with the label replaced by assistive text,
when it has an icon and `assistiveText.icon`. A child Button with a
`label` and an icon, such as the TrialBarDropdown trigger, lost its
visible label. When the child Button has a `label` and no
`assistiveText` of its own, clear the inherited icon text.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The pre-rewrite Accordion moved focus in `componentDidUpdate` only when
the focused panel index changed. The rewrite's `useEffect` also runs on
mount, so rendering an Accordion took focus from the page. Track the
previous index and only focus when it changes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
`dateDisabled` was typed `(date: Date) => boolean`, but the calendar
calls it with `{ date }`, so a handler written against the type got
an object instead of a Date. Type it
`({ date }: { date: Date }) => boolean`, drop the cast in
CalendarWrapper, and add a type test.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
These stories rendered broken layouts because they didn't use the
components' real props:

- Spinner AllSizes: add `isInline`, so the spinners sit in the row
  instead of stacking at the same absolute position
- SetupAssistant: mark steps complete with `progress={100}`;
  SetupAssistantStep has no `isComplete` prop
- PageHeader: wrap controls in `PageHeaderControl`, which PageHeader
  selects children by
- BuilderHeader: pass the nav as `builderNav` and the toolbar groups as
  `toolbarButtonGroups`
- Tooltip InButtonGroup: use a `list` ButtonGroup with `list-item`
  tooltips
- Checkbox ButtonGroup: render the `button-group` variant inside a
  checkbox ButtonGroup, which supplies the group wrapper

Co-Authored-By: Claude Opus 5.5 <[email protected]>
`.planning/` is gitignored agent scratch space (see AGENTS.md), but
ESLint still linted it locally, so a Storybook build or scripts there
made `npm run lint` fail.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Restoring `iconSize="large"` matched the pre-rewrite Toast, but under
SLDS 2 the close button renders too large. Keep `medium`, and drop the
matching test assertion, CHANGELOG line and snapshot changes. The
notify container class fix is unchanged.
@interactivellama

Copy link
Copy Markdown
Contributor

I checked https://www.lightningdesignsystem.com/2e1ef8501/p/216f79-toast And it looks more like the medium close icon on the toast component. I went ahead and pushed up the fix. My guess is it used to be larger in SLDS 1.

@interactivellama interactivellama 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.

@Niznikr Great finds! Thanks for being proactive!

@interactivellama
interactivellama merged commit 07fab38 into master Nov 4, 2026
10 of 11 checks passed
@interactivellama
interactivellama deleted the fix/slds2-visual-regressions branch November 4, 2026 23:01
interactivellama added a commit that referenced this pull request Nov 20, 2026
Every story, plus fixtures for the exported components no story renders,
mounts with focus on an outside input and re-renders its parent three
times; focus must not move. This is the class of the Accordion
mount-focus bug (#3276).

Components built to take focus on mount (open dialogs, dismissible
Alert, Toast) are listed with their reasons and must keep focus where
they put it. A coverage check fails when a new export is neither
rendered by a story nor classified.
interactivellama added a commit that referenced this pull request Nov 20, 2026
Every story, plus fixtures for the exported components no story renders,
mounts with focus on an outside input and re-renders its parent three
times; focus must not move. This is the class of the Accordion
mount-focus bug (#3276).

Components built to take focus on mount (open dialogs, dismissible
Alert, Toast) are listed with their reasons and must keep focus where
they put it. A coverage check fails when a new export is neither
rendered by a story nor classified.
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.

2 participants