Skip to content

feat!: controlled data and selection - #3269

Merged
interactivellama merged 43 commits into
masterfrom
feat/v11-controlled-state
Nov 5, 2026
Merged

interactivellama merged 43 commits into
masterfrom
feat/v11-controlled-state

Conversation

@Niznikr

@Niznikr Niznikr commented Oct 30, 2026 •

Copy link
Copy Markdown
Collaborator

Additional description

What and why. Before GA, every component now follows the control model in ROADMAP.md and docs/codebase-overview.md, so the props don't need another breaking change after 11.0:

  • Data and selection are controlled only. Anything that would live in app state (checked, value, a date, a selection) is a required prop plus a callback. There is no default* twin and no internal copy. The callback reports the requested value, and the component renders whatever the prop says, so a parent can reject a change.
  • Ephemeral UI state may be uncontrolled. This covers open state, the carousel panel and autoplay, and tree expansion. The mode is chosen by value !== undefined, never by whether a callback was passed. A default* prop seeds the uncontrolled state, a controlled value is always honored, and the callback always fires. Function components use the new useControllableState hook (utilities/hooks/use-controllable-state).

Breaking. Every breaking change is listed in the CHANGELOG under Unreleased: two BREAKING entries in Changed (data, then ephemeral state) and one in Removed. Each feat! commit has a BREAKING CHANGE: footer with the migration. In short:

Component Change
Checkbox, Radio checked required (Radio also onChange); defaultChecked removed
RadioGroup, RadioButtonGroup required group value: string | null; onChange(event, { value, checked })
ButtonStateful active → isActive (required); no internal toggle
Input, Combobox, Slider, Textarea defaultValue removed; Slider and Textarea value required; Textarea onChange(event, { value }); Input counter no longer edits the DOM
Tabs required value (matched against TabsPanel value or the index as a string) + onSelect; defaultSelectedIndex removed
MenuDropdown selection comes only from value; onSelect data gains value; isOpen controlled when not undefined; defaultIsOpen, onRequestOpen, onRequestClose
VerticalNavigation required selectedId: string | null + onSelect; no first-item default
SimpleDataTable selection required with selectRows, matched by id; columns render sortDirection only
Tree required selectedIds; expandedIds / defaultExpandedIds; nodes are never mutated
SplitView, SplitViewListbox defaultIsOpen; listbox selection/unread are ids
DatePicker required value: Date | null; formattedValue removed; defaultIsOpen
ColorPicker required value; isOpen honored; defaultIsOpen
Popover, Tooltip, ExpandableSection, SetupAssistantStep, Carousel default* props; mode keyed off the value prop; callbacks report the requested state

Shims. Each removed data prop is stripped before it reaches the DOM, ignored, and logs a dev-only sunset-property warning that names the replacement. Each renamed or reshaped input keeps working and logs a one-time deprecated-property warning:

  • ButtonStateful active
  • Tabs selectedIndex
  • checked on each Radio inside a group
  • Tree node.selected / node.expanded, read-only
  • item objects in SplitViewListbox selection

The new utilities/warning/required-property warns on any render where a required controlled prop is missing. one-of-required-property only checks the first render.

Bugs fixed on the way. Each has a regression test:

  • SimpleDataTable slds-is-sorted_asc never rendered. A literal false key overwrote the computed class (separate fix: commit).
  • SimpleDataTable stack overflow on re-render in development. The column memo deep-compared elements with dequal, which walked React's circular _owner.
  • Carousel autoplay stuck. It captured the starting panel and requested the same next panel on every tick.
  • Combobox couldn't open when given only events.onRequestOpen.
  • Popover wrote internal state while controlled. That state then took over when isOpen went back to undefined.
  • SplitViewListbox Shift-click range and Ctrl+A.
    • The range sorted indexes as strings.
    • Ctrl+A only deselected when selection === options.
  • Input counter auto-repeat used a stale value.

The stories and examples that relied on uncontrolled mode are now small stateful wrappers. The story snapshot diff has three changes, all in one commit:

  • 7 SimpleDataTable stories gain slds-is-sorted_asc.
  • Tabs DefaultSelectedIndex is renamed to InitialValue.
  • MenuDropdown Controlled loses its Reset button, because switching a menu back to uncontrolled isn't supported.

For the reviewer to decide or check:

  1. Two boolean defaults stay true. ExpandableSection and SplitView defaultIsOpen default to true, a documented exception to the boolean-default rule, so existing sections and split views still start open.
  2. ExpandableSection change has no runtime warning. onToggleOpen now reports the requested state, so setIsOpen(!data.isOpen) code inverts silently. The old pattern can't be detected at runtime. The CHANGELOG spells out the migration.
  3. Carousel autoplay back-compat. With hasAutoplay and no isAutoplayOn/defaultIsAutoplayOn, autoplay still starts. The ROADMAP asked for hasAutoplay to stop meaning "start playing". Should that wait until after the alpha?
  4. MenuDropdown onOpen/onClose with a controlled isOpen. They fire when the parent applies the change. The alternative was to never fire them when controlled.
  5. SimpleDataTableProps is now a union type alias. That breaks interface X extends SimpleDataTableProps.
  6. Tabs value is typed string, with no null. A missing value selects no tab and warns.
  7. Input and Combobox value stay optional. Their removed defaultValue warns, but value isn't required in the type.
  8. New onRequestClose triggers. ColorPicker Done reports 'submit'; DatePicker typing reports 'input-change'.
  9. SplitView fixes ride in the feat commit. The Shift-range and Ctrl+A fixes are inside feat(split-view)! rather than a separate fix: commit.
  10. Out of scope, recorded for later.
    • Tree leaf items use key={generateId()} and remount on every render (new ROADMAP item).
    • ColorPicker has no typing buffer for its input, and events.onOpen/onClose are still unwired.
    • Radio onKeyPress can fire twice on Space.
    • Checkbox's keydown handler builds a fake ChangeEvent.
    • Checkbox readOnly is accepted but unused.

Lint. 0 errors. 214 warnings, against 223 on master: the branch removes 9 and adds none.


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 30 commits October 30, 2026 11:19
Chooses controlled vs uncontrolled by whether the value prop is
!== undefined, and only writes internal state when uncontrolled.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…props

Selection and sort are data, so the table renders only what its props say
and reports the requested next state.

- `selection` is required when `selectRows` is set (`SimpleDataTableProps`
  is now a union on `selectRows`), and has no `[]` default prop.
- `selection` and `disabledSelection` stay arrays of items but are matched
  to `items` by `id` (reference identity only for items without an `id`).
  Fresh item objects, e.g. from a store, now match. Previously the row used a
  lodash deep partial match, select-all used reference identity and
  deselection used a deep match, so the three could disagree.
- The select-all state counts the rows in `items` that are selected, so
  selected items that aren't rendered no longer skew it.
- `onRowChange(event, { selection })` is the supported callback. The
  deprecated `onChange(selection, event)` still fires and warns once. Both
  get the same requested selection, computed from the `selection` prop.
- Row checkboxes and radios always get `checked` and `onChange` (never
  `defaultChecked`), disabled rows included; a disabled row never requests
  a change.
- Header cells no longer keep an internal `sortDirection` copy that drifted
  from the prop. The column renders `sortDirection` only, and `onSort`
  reports the requested next direction derived from it.
- Fix a stack overflow when a parent re-rendered the table with unchanged
  column children: the column memo deep-compared React elements with
  `dequal`, which walked the circular dev-mode `_owner` fiber. Elements are
  now compared by type, key and props. Without this, no stateful parent
  could update `selection` in development.

BREAKING CHANGE: `selection` is required in the type when `selectRows` is
set, and `SimpleDataTableProps` is a type alias (a union) rather than an
interface, so it can no longer be extended with `interface ... extends`.
Selection and disabled selection are matched by item `id`, not by a deep
partial match of the item. Columns render the `sortDirection` prop only: a
column with `isSorted` but no `sortDirection` no longer toggles its own
direction on click, so pass `sortDirection` and update it in `onSort`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…lumns

The header cell's class map had a computed `slds-is-sorted_${direction}`
key followed by a literal `slds-is-sorted_asc` key. For an ascending
column the literal key (false) overwrote the computed one, so sorted
ascending columns rendered without `slds-is-sorted_asc`. Story snapshots
for the seven stories with an ascending sorted column gain the class.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Tabs selection is data, so Tabs is now fully controlled. `TabsPanel` takes an
optional `value`, `Tabs` takes a required `value` (matched against the panel
`value`, or the panel index as a string when it has none) and a required
`onSelect`, and there is no internal selection copy. Clicks and arrow keys
only report the requested tab through `onSelect`; the stale-copy guard that
could fire or skip `onSelect` wrongly in controlled mode is gone, and
`onSelect` is no longer called for the already-selected tab or for
non-arrow keys. Rendered ids stay index-based.

`onSelect` data adds `value` and `previousValue` alongside `selectedIndex`
and `previousIndex`.

Adds `utilities/warning/required-property` for missing controlled props
(`one-of-required-property` only checks the first render per component).

ColorPicker keeps its "tab visible when the dialog opens" behavior through a
small private stateful wrapper around Tabs.

BREAKING CHANGE: `Tabs` `defaultSelectedIndex` is removed (ignored, with a
sunset warning); pass `value` and update it in `onSelect`. `value` and
`onSelect` are required. Without `value` (or the deprecated `selectedIndex`)
no tab is selected and a dev warning is logged. `selectedIndex` still works as
a controlled prop when `value` is absent, but is deprecated (warning).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
`value` is now required and fully controlled: the summary input and swatch
always render it, typing only reports `events.onChange`, and Done reports
the working color without writing internal state, so a parent can reject
either change. The working color is an internal draft that re-syncs from
`value` whenever the popover opens or `value` changes; `valueWorking` is
controlled whenever it is not `undefined`. `errorText` is derived from
`value` on every render instead of being seeded once.

`isOpen` is now honored when set (controlled via `onRequestOpen` /
`onRequestClose`), and `defaultIsOpen` seeds the uncontrolled state.

BREAKING CHANGE: ColorPicker `value` is required and controlled. Without
updating it from `events.onChange` the input no longer accepts typing and
Done no longer changes the color; a dev warning fires when `value` is
missing. `isOpen` is now honored (previously only seeded); use
`defaultIsOpen` for an initial open state. `onRequestOpen` no longer fires
when the swatch button closes the popover. Done now fires `onRequestClose`
with trigger `submit`. A controlled `valueWorking` now wins over internal
edits. `errorText` falls back to built-in validation of the current `value`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
`value` is now required, typed `Date | null`, and fully controlled; the
seeded `internalValue` is gone. The typed-text buffer stays internal but
re-syncs whenever `value` changes (by date identity, so an equal
`new Date()` per render does not reset typing, and accepting the typed date
does not reformat it). Clearing the input reports `date: null`.

`isOpen` is controlled whenever it is not `undefined`; `defaultIsOpen` seeds
the uncontrolled state. Open/close from mouse, keyboard and typing all go
through the same request path, and a controlled calendar never opens or
closes itself.

BREAKING CHANGE: DatePicker `value` is required and typed `Date | null`;
the component no longer stores a selected date itself, so update `value`
from `onChange`. `value={undefined}` is treated as `null` and warns.
`formattedValue` is removed (sunset warning; it is ignored). `onChange`
`data.date` can be `null`. Typing now requests close with the new
`input-change` trigger (also when `isOpen` is controlled). Passing
`onRequestOpen` without `isOpen` no longer prevents the calendar from
opening itself. New `defaultIsOpen` prop.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
VerticalNavigation no longer selects the first item when `selectedId` is
omitted, and keeps no internal copy of the selection. `selectedId`
(`string | null`) and `onSelect` are required; pass `null` for no
selection. A dev warning fires when `selectedId` is missing.

Also adds type-level regression tests for the controlled Tabs API.

BREAKING CHANGE: `selectedId` and `onSelect` are required on
VerticalNavigation. Omitting `selectedId` no longer selects the first
item; it renders no selection and warns in development.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…andedIds

Tree no longer mutates `nodes`. Selection is controlled data, passed as
`selectedIds` and reported as `data.selectedIds` in `onSelect`. Expansion
is ephemeral UI state: controlled with `expandedIds`, or uncontrolled from
`defaultExpandedIds`, and reported as `data.expandedIds` in
`onRequestToggle`. Focus and the roving tab stop stay internal, and the
tree now has one tab stop: the focused node, else the first visible
selected node, else the first node.

BREAKING CHANGE: `selectedIds` is required. Tree never writes `selected`
or `expanded` on `nodes`, so a consumer that relied on that mutation (for
example, arrow keys clearing other selected nodes in a multi-select tree)
must apply `data.selectedIds` / `data.expandedIds` instead. A tree
without `expandedIds` now expands and collapses on its own. When
`selectedIds` (or `expandedIds`/`defaultExpandedIds`) is absent, the
deprecated `node.selected` (or `node.expanded`) field is still read, as a
read-only fallback, and Tree warns once.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
SplitView decides the open-state mode by `isOpen !== undefined` and
starts uncontrolled from the new `defaultIsOpen` (default `true`, a
documented exception to the boolean-default rule). `events.onToggle` is
always called.

SplitViewListbox `selection` and `unread` are lists of item ids, and
`events.onSelect` reports the requested selection as `data.selection`
(alongside `selectedItems` and `item`). The shift-click anchor stays
internal. A shift-click range now orders indexes numerically, and starts
at the first selected item when nothing was clicked yet. Ctrl+A deselects
when every option is selected, not only when `selection === options`.

BREAKING CHANGE: SplitViewListbox `selection` and `events.onSelect` are
required, and items need an `id`. Passing item objects in `selection` or
`unread` is deprecated: they are still matched by `id` (or by identity
for items without an `id`) and the listbox warns once.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Popover state now goes through useControllableState. When `isOpen` is
set, the popover never writes internal state. It opens and closes only
when the prop changes. Previously a controlled popover still wrote
internal state, and that state leaked if `isOpen` went back to
undefined.

- `defaultIsOpen` sets the initial state of an uncontrolled popover.
- `onRequestOpen(event, { trigger })` fires on trigger click, or on
  hover/focus with `openOn="hover"`, controlled or not. Trigger values
  are 'triggerClick', 'mouseEnter' and 'focus'. A disabled popover does
  not request open.
- onOpen/onClose/onRequestClose are unchanged.
- Removed the unreachable keyboard open branch. `handleKeyDown` is only
  attached to the open dialog.
- The Controlled story and the controlled-with-footer example now open
  through `onRequestOpen` instead of the trigger's onClick. This fixes
  the example reopening when the trigger was clicked while open.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Tooltip state now goes through useControllableState. A controlled
tooltip (`isOpen` set) never writes internal state: `isOpen={false}`
keeps it closed and `isOpen={true}` keeps it open, whatever the user
does.

- `defaultIsOpen` sets the initial state of an uncontrolled tooltip.
- `onRequestOpen(event, { trigger })` fires on hover (after
  `hoverOpenDelay`) or focus, with trigger 'mouseEnter' or 'focus'.
- `onRequestClose(event, { trigger })` fires with trigger 'mouseLeave',
  'blur', 'cancel' (Escape) or 'clickOutside'. `event` is undefined for
  'clickOutside'.
- Nothing is requested when the dialog unmounts because the tooltip
  already closed.
- The trigger/children contract is unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… state

Whether the section is controlled is now decided by `isOpen !==
undefined`. Passing `onToggleOpen` alone no longer makes it controlled.
`onToggleOpen` is always called, and `data.isOpen` is the requested
(next) state.

`defaultIsOpen` sets the initial state of an uncontrolled section. It
defaults to `true` (sections start open), which is a documented
exception to the boolean-default rule. The InitiallyCollapsed story now
uses `defaultIsOpen={false}`.

BREAKING CHANGE: `onToggleOpen` reports the requested state in
`data.isOpen`, not the current one. Controlled consumers that did
`setIsOpen(!data.isOpen)` should use `setIsOpen(data.isOpen)`. An
uncontrolled section (no `isOpen`) with `onToggleOpen` now toggles
itself; before, the callback froze it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…Open

A Step is controlled when `isOpen !== undefined`. `onToggleIsOpen`,
including the parent's injected `onStepToggleIsOpen`, is always called
with the requested state. An uncontrolled step toggles itself.
`defaultIsOpen` sets the initial state of an uncontrolled step.

BREAKING CHANGE: a Step without `isOpen` now toggles when
`onToggleIsOpen` or SetupAssistant `onStepToggleIsOpen` is set. Before,
the callback froze it. Internal state is no longer seeded from `isOpen`.
Use `defaultIsOpen` for an uncontrolled initial state.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Panel and autoplay state go through useControllableState. Whether each
is controlled is decided by `currentPanel !== undefined` and
`isAutoplayOn !== undefined`, not by whether `onRequestPanelChange` or
`onRequestAutoplayToggle` is passed. Both callbacks are always called
with the requested state.

- `defaultCurrentPanel` (default 0) and `defaultIsAutoplayOn` set the
  uncontrolled initial state.
- `hasAutoplay` enables the feature. The start state is
  `isAutoplayOn ?? defaultIsAutoplayOn`. For back-compat, when neither
  is set, autoplay starts if `hasAutoplay` is true.
- The autoplay interval now reads the latest state on each tick. Before,
  it captured the starting panel and kept requesting the same next
  panel.

BREAKING CHANGE: passing `onRequestPanelChange` or
`onRequestAutoplayToggle` no longer makes the carousel controlled. An
uncontrolled carousel with these callbacks now moves and toggles
itself. `isAutoplayOn` has no effect without `hasAutoplay`, which also
renders the pause button. Before, autoplay ran with no way to pause it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
`checked` is now required and is always rendered as `checked={!!checked}`,
so the input never flips between controlled and uncontrolled. `onChange`
reports the requested value (`indeterminate` resolves to checked) and the
DOM `indeterminate` property is restored after the native click clears it,
so `indeterminate` stays controlled by the prop.

Examples that rendered uncontrolled checkboxes (checkbox, button-group,
welcome-mat, progress-indicator) now keep `checked` in state, and the
stories use a stateful wrapper.

BREAKING CHANGE: Checkbox `defaultChecked` is removed. It is ignored and
logs a sunset warning. Pass `checked` and update it in `onChange`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… value

Radio now requires `checked` and `onChange`, and always renders
`checked={!!checked}`. RadioGroup and RadioButtonGroup take a required
`value: string | null` and derive each child's `checked` from
`child.props.value === value`. `onChange(event, { value, checked })`
reports the selected value (`null` on deselect). Children are typed with
`RadioGroupItemProps`, so they don't need `checked` or `onChange`.

When the group `value` is undefined, the per-Radio `checked` props are
still honored and a one-time deprecation warning is logged.

Consumers updated: radio, radio-group, radio-button-group and
visual-picker examples and stories; color-picker passes `value` to its
RadioButtonGroup; the simple-data-table disabled Radio gets `onChange`.

BREAKING CHANGE: Radio `defaultChecked` is removed. It is ignored and logs
a sunset warning. Radio `checked` and `onChange` are required.
RadioGroup and RadioButtonGroup require `value`. Pass `value` to the group
instead of `checked` on each Radio, and read `data.value` in `onChange`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
ButtonStateful no longer keeps internal state. It renders from the
required `isActive` prop and calls `onClick(event, { isActive: !isActive })`
with the requested value. Examples and stories keep `isActive` in state.

BREAKING CHANGE: ButtonStateful `active` is renamed to `isActive` and the
internal toggle state is removed. `active` still works as a deprecated
alias and logs a warning. `isActive` wins when both are passed. Pass
`isActive` and update it from `onClick`'s `data.isActive`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
# Conflicts:
#	components/simple-data-table/private/row.tsx
Formatting only, split out so the controlled-value change is reviewable.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Input is now controlled only. `defaultValue` is removed from the type; it is
still accepted at runtime, ignored, and warns once in development.

The counter variant no longer reads or writes the DOM. Increment and
decrement compute the next value from the `value` prop (0 when unset) and
report it through `onChange(event, { number, value })`; the input only
changes when the parent updates `value`. Held-button auto-repeat steps from
the latest `value` instead of a stale closure.

BREAKING CHANGE: `Input` no longer supports `defaultValue`. Pass `value` and
update it from `onChange`. The counter variant no longer updates the input
itself when its buttons are pressed: set `value` from `data.value` (or
`data.number`) in `onChange`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…alue

`isOpen` is now ephemeral state: when it is undefined the combobox manages
its own open state (seeded by the new `defaultIsOpen`); when it is defined
the parent owns it. This fixes passing only `events.onRequestOpen`, which
used to leave the menu unable to open.

All open and close paths (click, arrow keys, Escape, Enter, blur, select,
click outside, popover Cancel/Done) now go through one request path:
`events.onRequestOpen` / `events.onRequestClose` are called first, and the
state changes only when uncontrolled. `events.onOpen` / `events.onClose`
fire on real transitions, so with a controlled `isOpen` they reflect what
the parent decided rather than the request.

`defaultValue` is removed from the type; it is still accepted at runtime,
ignored, and warns once in development. The action-item `onSelect` data
reads `value` from the prop instead of the DOM.

BREAKING CHANGE: `Combobox` no longer supports `defaultValue`; pass `value`
and update it from `events.onChange`. With a controlled `isOpen`,
`events.onClose` no longer fires when the combobox merely requests a close,
and `events.onRequestClose` now fires for every close path (Escape, blur,
select, Done), not only click-outside and Enter. `events.onRequestOpen` is
called with `(event, {})` and only while closed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…trolled Checkbox

Checkbox no longer keeps an internal copy of checked, so the toggle
actions in the examples hold their own state. The hub example binds its
substep toggle to the completion state it already tracks; it read
event.target.checked without a checked prop and could never un-complete.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Textarea is controlled only. `value` and `onChange` are required in the
type, and `onChange` now receives `(event, { value })`. `defaultValue` is
removed from the type; it is still accepted at runtime, ignored (no longer
passed to the DOM), and warns once in development.

Examples and stories keep their text in state.

BREAKING CHANGE: `Textarea` no longer supports `defaultValue`. `value` and
`onChange` are required; update `value` from `data.value` (or
`event.target.value`) in `onChange`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Slider is controlled only. `value` is required in the type, and the
displayed value comes only from `value`. `defaultValue` is removed from the
type; it is still accepted at runtime, ignored, and warns once in
development. `onChange(event, { value })` is unchanged.

Examples and stories keep their value in state.

BREAKING CHANGE: `Slider` no longer supports `defaultValue`, and `value` is
required. Update `value` from `data.value` in `onChange`. A slider without
`value` no longer displays `0`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Niznikr and others added 8 commits October 30, 2026 11:45
…isOpen

Selection is data: the checkmark/multiple selection now comes only from
`value`, derived on every render (including the first), and is no longer
toggled internally. `onSelect` data adds `value`, the requested next
value (the option's value, or the toggled array when `multiple`).

The open state is ephemeral: `isOpen !== undefined` makes it controlled,
`defaultIsOpen` seeds the uncontrolled state. New `onRequestOpen` and
`onRequestClose(event, data)` are called for every open/close request in
both modes. With a controlled `isOpen` no internal state changes; `onOpen`
and `onClose` fire when the menu actually opens or closes (with the
matching request event when there was one). Opening a menu now asks the
previously open one to close through its latest handler.

BREAKING CHANGE: MenuDropdown no longer keeps its own selection. Selecting
an item does not move the checkmark or toggle a `multiple` item unless the
parent updates `value` from `onSelect` (`data.value`); without `value`
there is no selection state. A controlled `isOpen` (now any value other
than `undefined`) is always honored: clicks, keys, hover and outside
clicks call `onRequestOpen`/`onRequestClose` instead of opening or closing
the menu, and `onOpen`/`onClose` are no longer called for requests the
parent does not apply.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>

# Conflicts:
#	components/button-group/__examples__/icon-group.jsx
…enuDropdown selection

The split-view header "Display As" menus passed a static value with an
onSelect that only logged, so the checkmark could never move once
MenuDropdown derived selection from value. They now keep the value in
state. The files actions menu has no checkmark, so its static value only
marked the first item selected; it is dropped.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- SimpleDataTable: sorted headers carry slds-is-sorted_asc
- Tabs: DefaultSelectedIndex story renamed to InitialValue
- MenuDropdown: Controlled story drops the Reset button

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Also folds the duplicate Removed heading under Unreleased into one, and
corrects the earlier Tabs and DatePicker entries that described the
pre-control-model behavior.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
ROADMAP: theme 2 gets a Done summary, fully done control-model items are
checked off, and mixed items note what is still open. Adds the tree leaf
`key={generateId()}` remount finding.

codebase-overview: point at useControllableState and the sunset-property
pattern from the control-model rule.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Writing the ref during render tripped react-hooks/refs. A layout effect
updates it before any event handler can call the setter, so the setter
stays stable and still never writes state while controlled.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@interactivellama

interactivellama commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

@Niznikr I found a bug in the sort arrow. The LLMs were changing the icon and the CSS class, so double flip. :-P #3278

@interactivellama

interactivellama commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Checkbox, RadioGroup, RadioButtonGroup, ButtonStateful, Slider, SimpleDataTable, Tree, DatePicker and ColorPicker appear to require value but leave the callback optional.

What are the reasons you believe we should we require the callback or make it optional?

…asc (#3278)

* style(simple-data-table): apply prettier to header cell

* fix(simple-data-table): flip the sort arrow only with slds-is-sorted_asc

Clicking a sorted column's header left the sort arrow pointing down in
both directions.

Root cause: SLDS draws the sort icon as a down arrow and rotates it 180deg
under `slds-is-sorted_asc`. The header cell also swapped the glyph, using
`arrowup` for ascending. Before a4be8d0 the `slds-is-sorted_asc` class
was never applied, because a duplicate classnames key overwrote it, so the
glyph swap was the only flip. Once the class was applied, ascending columns
rendered `arrowup` rotated 180deg, which also points down.

Always render `arrowdown` and let `slds-is-sorted_asc` turn it, as the SLDS
blueprint does. An unsorted column's hover arrow now points down, matching
SLDS, instead of up.
@Niznikr

Niznikr commented Nov 4, 2026

Copy link
Copy Markdown
Collaborator Author

Checkbox, RadioGroup, RadioButtonGroup, ButtonStateful, Slider, SimpleDataTable, Tree, DatePicker and ColorPicker appear to require value but leave the callback optional.

What are the reasons you believe we should we require the callback or make it optional?

I'd require it. Making the value required but the callback optional means a missing handler gives you a control that silently does nothing. React would normally warn about that, but these components attach their own internal handler, so the warning never fires.

@interactivellama

Copy link
Copy Markdown
Contributor

Let's proceed with requiring the value change callbacks.

Niznikr and others added 3 commits November 4, 2026 17:37
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]>
Checkbox, RadioGroup, RadioButtonGroup, ButtonStateful, Slider,
DatePicker, ColorPicker, SimpleDataTable and Tree require their value
prop but left the callback optional. Without the callback the control
renders but can't change, which is a silent bug.

The callback is now required in the props types unless the control is
`disabled: true` (or `readOnly: true` for Checkbox). A literal `true` is
needed to skip it, so `disabled={flag}` still requires the callback.
A missing callback warns once in development through
`utilities/warning/required-property`.

- Checkbox, RadioGroup, RadioButtonGroup, Slider, DatePicker: `onChange`
- ButtonStateful: `onClick`
- ColorPicker: `events.onChange`
- SimpleDataTable: `onRowChange`, only when `selectRows` is set
- Tree: `onSelect`

The deprecated SimpleDataTable `onChange` and Tree `onClick` still fire,
so they satisfy the runtime check but not the types.

BREAKING CHANGE: TypeScript consumers must pass the change callback, or
set `disabled` (or `readOnly` for Checkbox), on these components. Their
props types are now type aliases instead of interfaces, so they can't be
extended with `interface ... extends`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@interactivellama

Copy link
Copy Markdown
Contributor

When this merges, #2965 should close.

@interactivellama interactivellama mentioned this pull request Nov 4, 2026
7 of 17 tasks
@interactivellama

Copy link
Copy Markdown
Contributor

@Niznikr Please resolve conflicts.

@interactivellama
interactivellama merged commit f618500 into master Nov 5, 2026
11 checks passed
@interactivellama
interactivellama deleted the feat/v11-controlled-state branch November 5, 2026 21:31
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