Repository navigation
fix(simple-data-table): flip the sort arrow only with slds-is-sorted_asc - #3278
Merged
interactivellama merged 2 commits intoNov 4, 2026
Merged
interactivellama merged 2 commits into
interactivellama merged 2 commits into
Conversation
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.
12 of 15 tasks
Niznikr
approved these changes
Nov 4, 2026
interactivellama
added a commit
that referenced
this pull request
Nov 5, 2026
* feat(utilities): add useControllableState for ephemeral UI state 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]> * style: format expandable-section and popover story files Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(simple-data-table)!: control selection by item id and sort from 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]> * fix(simple-data-table): add slds-is-sorted_asc to ascending sorted columns 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]> * feat(tabs)!: select tabs by a controlled value 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]> * feat(color-picker)!: make value controlled and honor isOpen `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]> * feat(date-picker)!: make value controlled and isOpen ephemeral `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]> * feat(vertical-navigation)!: require a controlled selectedId 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]> * feat(tree)!: control selection and expansion with selectedIds and expandedIds 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]> * feat(split-view)!: control listbox selection by id and add defaultIsOpen 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]> * feat(popover): add defaultIsOpen and onRequestOpen 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]> * feat(tooltip): add defaultIsOpen, onRequestOpen and onRequestClose 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]> * feat(expandable-section)!: add defaultIsOpen and report the requested 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]> * feat(setup-assistant)!: add defaultIsOpen to Step and key mode off isOpen 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]> * feat(carousel)!: add defaultCurrentPanel and defaultIsAutoplayOn 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]> * feat(checkbox)!: make Checkbox controlled only `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]> * feat(radio-group)!: control Radio, RadioGroup and RadioButtonGroup by 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]> * feat(button-stateful)!: control ButtonStateful with isActive 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]> * style(input): format with prettier Formatting only, split out so the controlled-value change is reviewable. Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat(input)!: remove defaultValue and make the counter fully controlled 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]> * feat(combobox)!: make isOpen uncontrolled-capable and remove defaultValue `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]> * docs(setup-assistant): keep example toggle actions working with a controlled 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]> * feat(textarea)!: require value and onChange, pass { value } to onChange 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]> * feat(slider)!: require value and remove defaultValue 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]> * feat(menu-dropdown)!: derive selection from value and add controlled 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]> * docs(split-view, files): keep example menus working with controlled MenuDropdown 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]> * test: update story snapshots for controlled data and selection - 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]> * docs(changelog): describe controlled data and selection 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]> * docs: record controlled data and selection progress 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]> * refactor(utilities): sync useControllableState's mode ref after commit 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]> * style(menu-dropdown): drop unused menu reassignments in tests Co-Authored-By: Claude Opus 5.5 <[email protected]> * fix(simple-data-table): flip the sort arrow only with slds-is-sorted_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. * style: prettier-format ButtonStateful, ColorPicker and DatePicker files Co-Authored-By: Claude Opus 5.5 <[email protected]> * feat!: require the change callback on controlled data components 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]> --------- Co-authored-by: Claude Opus 5.5 <[email protected]> Co-authored-by: Stephen James <[email protected]>
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.
Stacked on #3269 (
feat/v11-controlled-state). It needs no issue link: the bug only exists on that branch.Additional description
Symptom: on #3269, clicking a sortable column's header leaves its sort arrow (
slds-is-sortable__icon) pointing down in both directions. An unsorted column's arrow points up on hover, then points down after the first click and never changes again.Root cause: SLDS always draws the sort icon as a down arrow and rotates it 180deg when the
thhasslds-is-sorted_asc(see.slds-is-sorted_asc .slds-is-sortable__iconin the SLDS data-table styles, "Change direction of arrow"). The header cell also swapped the icon, usingarrowupfor ascending:slds-is-sorted_asc, so it was never applied and the icon swap was the only flip. The arrow looked right by accident.arrowuprotated 180deg, which points down, and descending columns renderedarrowdown, also down.Fix: always render
arrowdownand letslds-is-sorted_ascturn it up, as SLDS intends. One visible change: hovering an unsorted sortable column now shows a down arrow instead of up, which matches SLDS.Regression test:
Controlled sort > points the arrow up when ascending and down when descendinginsimple-data-table.test.jsx. A parent-controlled column is clicked twice, and the test works out the drawn direction from the icon plus theslds-is-sorted_ascrotation. It expects up, down, up. It fails before the fix and passes after.Snapshots: the story snapshot diff only replaces
#arrowupwith#arrowdownon sortable header icons (24 lines).Note on the original report: the report described the browser window crashing or freezing on a sort click. That didn't reproduce in Chromium, headless or headed, in the Storybook manager or the story iframe, or clicking the link or the icon. A browser test with a focus-loop guard didn't catch it either. The reporter couldn't reproduce it again, and the reproducible bug was this arrow. This PR doesn't claim to fix a hang.
Commits:
style(simple-data-table): apply prettier to header cell: format-only, from the pre-commit hookfix(simple-data-table): flip the sort arrow only with slds-is-sorted_ascCONTRIBUTOR 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.