Skip to content

feat!: put className, style and ref on the outermost element - #3268

Merged
interactivellama merged 3 commits into
masterfrom
feat/v11-classname-root
Nov 2, 2026
Merged

interactivellama merged 3 commits into
masterfrom
feat/v11-classname-root

Conversation

@Niznikr

@Niznikr Niznikr commented Oct 30, 2026 •

Copy link
Copy Markdown
Collaborator

Additional description

Slider, Spinner, Tree, Modal, Popover, WelcomeMat and VerticalNavigation now put className, style and the forwarded ref on the outermost element they render. Every other node gets a prop suffixed with its part name (classNameDialog, classNameSpinner, styleList, ...).

Before this, each component picked its own target. Popover put className on the dialog and triggerClassName on the root. WelcomeMat put it on an inner node. Five of the seven forwarded no ref at all.

The rule in docs/codebase-overview.md said className goes on "the node carrying .slds-[component]". That conflicts with "the real root" for components that wrap the SLDS node, such as Popover's trigger wrapper and Spinner's container. The rule now says the outermost rendered element. For portal-rendered components, that means the outermost element inside the portal (Modal's section.slds-modal), and the portal node gets classNamePortal.

Breaking: two silent moves

These can't warn, because the prop name stays the same:

  • Popover: className and style move from the .slds-popover dialog to the root trigger wrapper div. To keep styling the dialog, use classNameDialog and styleDialog.
  • WelcomeMat: className moves from .slds-welcome-mat__info-content to the root .slds-welcome-mat.

Deprecated, still working

Each old name is merged with its replacement and logs a one-time development warning through utilities/warning/deprecated-property.

Component Old New
Slider classNameContainer className
Spinner containerClassName, containerStyle className, style
Tree listClassName, listStyle classNameList, styleList
Modal containerClassName, contentClassName, contentStyle, footerClassName, headerClassName, portalClassName classNameContainer, classNameContent, styleContent, classNameFooter, classNameHeader, classNamePortal
Popover contentsClassName, triggerClassName, footerClassName, footerStyle classNameDialog, className, classNameFooter, styleFooter

Ref targets

Component ref points at
Slider .slds-form-element
Spinner .slds-spinner_container, or .slds-spinner with hasContainer={false}
Tree .slds-tree_container
Modal section.slds-modal
Popover the trigger wrapper div
WelcomeMat .slds-welcome-mat
VerticalNavigation nav.slds-nav-vertical

Also in this PR

  • Popover's styleFooter also applies to walkthrough footers, matching what fix(popover): apply classNameFooter to walkthrough footers #3246 did for classNameFooter.
  • Combobox, Filter, ColorPicker and EditDialog use the new Popover prop names internally, so the library doesn't trigger its own warnings.
  • New .d.ts files for utilities/warning/deprecated-property and utilities/get-component-doc, so TypeScript components can call them. Popover calls deprecatedProperty directly because its check-props.js isn't wired up.
  • CHANGELOG and ROADMAP are updated. The ROADMAP marks theme 6 as done and removes the className and forwardRef items this PR resolves.

fix(modal) commit

Root cause: #3248 removed Modal's title and closeButtonAssistiveText. The #3251 rebase put them back in ModalProps and the destructuring, but nothing reads them, so passing either one type-checked and did nothing. This commit removes them again.

It also fixes the progress-indicator modal example. That example passed title, so no header rendered, and a misspelled footerClassNames, which never matched a prop.

Reviewing

There are three commits. style: is prettier only. fix(modal): is small. feat!: re-indents whole component bodies because of the forwardRef wrap, so turn on Hide whitespace for that commit.

On the touched files, lint warnings go from 50 to 45. That drop isn't a fix: the React-hooks lint rules don't analyze forwardRef callbacks, so the same Modal and Tree code is no longer flagged.

Tests added:

  • A ref test for each component.
  • Root and inner-node class and style tests, including Popover's root versus dialog.
  • Old-name tests that reload the module so the one-time warning fires, then check both the merged classes and the warning text.

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 3 commits October 30, 2026 10:28
#3248 removed both props, and the callback-shapes rebase in #3251
reintroduced them in ModalProps and the destructuring. Nothing reads
them, so passing either one did nothing.

The progress-indicator modal example passed `title` (so no header
rendered) and `footerClassNames`, which never matched a prop. Use
`heading` and `footerClassName`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Slider, Spinner, Tree, Modal, Popover, WelcomeMat and VerticalNavigation
now forward `ref` to the outermost element they render, which is also
where `className` and `style` land. Other nodes take suffixed props
(`classNameDialog`, `classNameSpinner`, `classNameList`, `styleFooter`,
...). Props named the old way (`containerClassName`, `listStyle`,
`footerClassName`, `triggerClassName`, ...) still work, are merged with
their replacements, and log a one-time development warning. Popover's
`styleFooter` applies to walkthrough footers too, like `classNameFooter`.

The docs rule in codebase-overview.md now says the outermost rendered
element, not the `.slds-[component]` node.

BREAKING CHANGE: Popover `className` and `style` apply to the root
trigger wrapper instead of the `.slds-popover` dialog; use
`classNameDialog` and `styleDialog` for the dialog. WelcomeMat
`className` applies to `.slds-welcome-mat` instead of
`.slds-welcome-mat__info-content`. See CHANGELOG.md.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@interactivellama
interactivellama merged commit cd620e5 into master Nov 2, 2026
10 checks passed
@interactivellama
interactivellama deleted the feat/v11-classname-root branch November 2, 2026 08:42
Niznikr added a commit that referenced this pull request Nov 4, 2026
Conflicts came from #3268 (forwardRef, className on the root), #3266
(Input counter), #3270 (Carousel autoplay) and #3265 (MenuDropdown
open registration).

- Slider, VerticalNavigation, Popover, Tree: keep master's forwardRef,
  root className and classNameList/styleList, with the controlled
  value and selection from this branch.
- Input, Carousel, MenuDropdown: keep this branch's implementation,
  which already fixes the same stale closures through refs. Master's
  regression tests are kept; the uncontrolled Input maxValue test is
  rewritten for a controlled counter.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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