Repository navigation
feat!: move the remaining callbacks to (event, data) - #3280
Closed
interactivellama wants to merge 19 commits into
Closed
interactivellama wants to merge 19 commits into
interactivellama wants to merge 19 commits into
Conversation
onRequestClose received only the click event. It now also receives
{ trigger: 'close-button' }, matching Toast, and the data type is exported
as AlertRequestCloseData. Existing (event) handlers keep working.
onRequestOpen was called with no arguments. It now receives the swatch
button click and { trigger: 'triggerClick' }, typed as the exported
ColorPickerRequestOpenData. Existing no-argument handlers keep working.
events.onRequestMinimize and onRequestExpand now receive the requested open
state as data ({ isOpen }), and onRequestClose receives { trigger:
'close-button' }. Adds the DockedComposerRequestToggleData and
DockedComposerRequestCloseData types. Existing (event) handlers keep working.
onSearch (Enter or search icon click) and onClear now receive the input's current value as data. The value is read from the input element, so it is right whether or not value is controlled; a consumer inputRef still receives the element. Adds the SearchData and SearchClearData types and the first Search tests. Existing (event) handlers keep working.
onRemove took no arguments and onClick got no event when fired by Enter.
Both now receive the event and { trigger }: 'click' or 'enter' for onClick,
'remove-button', 'backspace' or 'delete' for onRemove. Adds the
PillClickData and PillRemoveData types. Existing handlers keep working.
onClick took no arguments. It now receives the click event and { id },
matching onChange and onRemove. Adds the FilterClickHandler type. Existing
handlers keep working.
…d onSave
The footer buttons now call onCancel and onSave with the click event and
{ isModified }, so a cancel handler can tell whether there are changes to
discard. Adds the EditDialogActionData type and the first EditDialog
tests. Existing (event) handlers keep working.
… onSort
events.onSort got only the event, so every example worked out the next
direction itself. It now also receives { sortDirection }, the requested
direction (the opposite of sortDirection, or 'down' when unset). Adds the
SplitViewListboxSortData type and updates the examples to use it. Existing
(event) handlers keep working.
onTogglePanel got only the event, so each consumer looked up which panel and which state from its own closure. It now also receives the panel id and the requested expansion state. onClickSummary, which Accordion injects and always overrides, now gets the event and is documented as internal. Adds the AccordionPanelToggleData type. Existing (event) handlers keep working.
…callbacks
onClickAdd, onClickRemoveAll, onRequestCancel, onRequestClose and
onRequestSave now receive the click event and { action }, so one handler can
serve several buttons. The private header and footer are unchanged; the group
wraps their callbacks. Adds the PanelFilterGroupActionData and
PanelFilterGroupActionHandler types and the first PanelFilterGroup tests.
Existing (event) handlers keep working.
onSort was called as (data, event) and RowActions onAction as
(item, option). Both now follow the (event, data) convention:
onSort(event, { property, sortDirection }) and
onAction(event, { item, option }). onLoadMore, which took no arguments,
now receives (event, { trigger }). The examples and tests use the new
signatures. The deprecated onChange(selection, event) is unchanged; it
already warns and points to onRowChange.
BREAKING CHANGE: SimpleDataTable onSort is called as
onSort(event, { property, sortDirection }) instead of
onSort({ property, sortDirection }, event), and SimpleDataTableRowActions
onAction as onAction(event, { item, option }) instead of
onAction(item, option).
…the menu
The events data was typed Record<string, unknown> and always {}.
onRequestOpen now gets { trigger } ('click', 'typing', 'down', 'enter'),
onRequestClose and onClose get { trigger } ('escape', 'blur', 'select',
'enter', 'cancel', 'done', 'click-outside', 'trigger-click'), onOpen gets
{ portal } and onFocus gets { value }. Which closes also call the
popover's own onClose is unchanged. Adds the data types and trigger unions.
This was referenced Nov 11, 2026
8 of 15 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes the theme 4 "Callback shapes" items in ROADMAP.md.
Additional description
Moves the remaining callbacks to the
(event, data)shape. Most of theme 4 already landed in #3251 (Tabs, MenuDropdown, Carousel, SetupAssistant, Popover, Tree, SplitView, PillContainer, Toast, Modal, WelcomeMat, DatePicker), but those roadmap items were never ticked; this PR finishes the rest and ticks them.There is one commit per component (with a
style:commit first where formatting changed), so it can be reviewed commit by commit.onRequestClose(event, { trigger: 'close-button' }), matching ToastonRequestOpen(event, data)(took no arguments)events.onRequestMinimize/onRequestExpand(event, { isOpen }),events.onRequestClose(event, { trigger })onSearch/onClear(event, { value })onClick(event, { trigger }),onRemove(event, { trigger })(onRemovehad no event on keyboard removal)onClick(event, { id })(took no arguments)onCancel/onSave(event, { isModified })events.onSort(event, { sortDirection })onTogglePanel(event, { id, isExpanded }),isExpandedis the requested state(event, { action })onSort(data, event)→onSort(event, data),onAction(item, option)→onAction(event, { item, option });onLoadMore(event, { trigger })data(wasRecord<string, unknown>, always{}) with atriggerononRequestOpen/onRequestClose/onClose, plusonOpen { portal }andonFocus { value }Every component exports a
*Datatype for its payload and has tests asserting it. All changes except simple-data-table add a trailing argument, so existing handlers keep working.Breaking change (simple-data-table): handlers written as
onSort={(sortColumn) => …}oronAction={(item, option) => …}must take the event first. Migration:onSort={(event, sortColumn) => …},onAction={(event, { item, option }) => …}. The deprecatedonChange(selection, event)is unchanged. The examples are updated and CHANGELOG has a BREAKING entry.Not in this PR (low priority, plain clicks): builder-header
onClickBack/onClickHelp, filesonClickDownload/onClickImage, alert/toastonClickHeadingLink.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 lintpasses with 0 errors (npm run lint:fixto auto-fix). Warnings are the tracked gradual-migration backlog; do not add new errors.npm run typecheckis clean (tsc --noEmit).npm test -- --runpasses — this runs both Vitest projects (jsdomunit+ real-browserbrowser) and the story HTML snapshots. If you changed rendered markup on purpose, update snapshots withnpm test -- --run -uand review the diff.npm run buildsucceeds (type-check + Vite library build +.d.ts+ entry shims).Behavior & docs:
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.jsxfile (thebrowserproject); everything else is jsdom.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).content/visualPickerFigure, render props likerenderItem,iconprops,events), not assumptions — a common source of "component looks broken" reports has been stories authored against the wrong API. Cross-check againstcomponents/<name>/__examples__..d.ts(they're generated by the build); JS consumers rely on them via editor type-acquisition.REVIEWER checklist (do not remove)
CIworkflow: lint, typecheck, test, build). Chromatic visual review, if configured, has been checked.components/__tests__/__snapshots__/story-snapshots.test.jsx.snap).@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.