Skip to content

fix!: v11 P1 theme 1, behavior and accessibility fixes - #3284

Merged
interactivellama merged 18 commits into
masterfrom
feat/v11-p1-1-behavior-fixes
Nov 10, 2026
Merged

interactivellama merged 18 commits into
masterfrom
feat/v11-p1-1-behavior-fixes

Conversation

@interactivellama

@interactivellama interactivellama commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Fixes the theme 1 "behavior-fixes" items in the ROADMAP.md P1 prop API freeze review.

Additional description

Runtime and accessibility fixes that keep the current API. This is the bottom of an 8-PR stack (behavior-fixes, removals, callbacks, slots, labels-naming, root-and-refs, typing, data-models), ordered from the smallest break to the largest. It targets master.

Stack after the 2026-11-08 scope cut. The themes were re-ranked by how much they help someone (or an agent) write correct code against the published types: wrong code fails tsc, one pattern holds across components, and nothing compiles but silently misbehaves. Themes 1 and 2 keep their full scope. Themes 3–8 were trimmed before pushing:

  • 3 callbacks: keeps the breaking (event, data) changes; the additive renames (date-picker isValid, icon-settings getIconPath, modal disableCloseOnClickOutside, edit-dialog onRequestOpen, tooltip getTargetElement) are deferred past GA.
  • 4 slots and 6 root-and-refs: unchanged.
  • 5 labels-naming: only the accessibility and native-name items (heading levels, landmark and group names, aria-labelledby, required). English-default moves into labels are deferred; the selectionMode, autoCloseDelay and errorIcon renames and tooltip's default-content removal are cut.
  • 7 typing: kept, minus the cosmetic tabs className narrowing and two naming-only changes.
  • 8 data-models: keeps the changes that remove an illegal or silent state (carousel autoplay, filter open state, one status per progress step, tooltip isDisabled, docked-composer defaultIsOpen); the additive ones are deferred and the menu-list alias removal is cut.

Deferred work stays on tags and can land in an 11.x minor.

The first commit is a single style: commit with all the prettier-only reformatting; after that there is one fix commit per component, so it can be reviewed commit by commit. Alert is unchanged: it still focuses its close button on mount.

Component Change
button-stateful no longer blurs itself on mouse leave or blur; onMouseDown is called in the text variants; the selected text shows after a mouse click
combobox disabled reaches the input in every variant; singleInputDisabled is deprecated
date-picker an input prop with its own onChange/inputRef no longer replaces the picker's (which broke typing and focus on close)
checkbox BREAKING: Enter no longer fakes a change and onChange never gets a KeyboardEvent; readOnly is applied (aria-readonly, focusable, no toggle)
docked-composer an open composer focuses its dialog on mount or open and returns focus on unmount; minimize/expand keeps focus; aria-describedby only while open
filter aria-describedby only points at an error element that is rendered
page-header a title of 0 renders; a boolean title renders nothing
pill the link variant's <a> is no longer wrapped in role="button"
popover the trigger's own focus and mouse handlers run alongside the popover's
popover/edit-dialog a consumer onOpen/onClose/onRequestClose no longer replaces the dialog's own state handling
progress-indicator a step id of 0 is used in DOM ids
tree leaf items are keyed by node id instead of remounting each render
simple-data-table fixedLayout drops the vestigial grid markup; ResizeObserver replaces the window resize listener; the two fixed-header listener callbacks are deprecated
vertical-navigation BREAKING: items without url render a <button>, and url is optional
visual-picker BREAKING: VisualPickerLink requires href (warns once when missing)
welcome-mat the info badge check renders only when complete; new assistiveText.image

Decisions

  • alert: focusing the close button on mount and restoring focus on unmount stays the default (implemented as opt-in, then reverted).
  • accordion: the first summary button stays the initial tab stop (roving tabindex, per the APG). No code change.
  • combobox: singleInputDisabled becomes a deprecated alias for disabled, to be removed at GA.
  • date-picker: the picker's onChange/inputRef are composed with the consumer's (consumer first); other input props keep "consumer wins".
  • docked-composer: keep role="dialog" (SLDS); focus the dialog when it opens without a click, but not when it mounts minimized.
  • simple-data-table: onToggleFixedHeaderListeners/onFixedHeaderResize are deprecated via sunset-property and still called until GA.
  • vertical-navigation: a <button> instead of <a role="button"> for items without url.
  • visual-picker: href is required in the type, with a required-property runtime warning.

Breaking changes and migration (CHANGELOG has the details):

  • Checkbox: handlers that relied on Enter toggling should listen to onKeyDown.
  • VerticalNavigation: widen onSelect event annotations to HTMLAnchorElement | HTMLButtonElement, and update selectors that target a.slds-nav-vertical__action.
  • VisualPickerLink: pass href, or use a Checkbox or Radio visual picker for options that don't navigate.

TinyNod (pre-push, advisory): findings, 5 total, none fixed. The one warning (pill/index.tsx:258, "no null guard on return value") is a false positive: that line is a className attribute. The 4 info findings (bundle size, naming) are generic and not actionable.


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.

Prettier-only reformatting of the alert, combobox, date-picker,
docked-composer, page-header, pill, popover and simple-data-table files
that the following commits touch, so their diffs show only the fixes.
…in every variant

The button blurred itself on mouse leave (and on blur) after a mouse
click, so focus fell to <body> and the next Tab restarted from the top
of the page. It also called the consumer's onBlur with a MouseEvent.
Stop blurring; focus now behaves like a native button.

With focus kept, SLDS's `.slds-is-selected:focus` rule would show the
hover/focus text ("Unfollow") right after the user chose "Following".
Toggle `slds-is-selected-clicked`, which SLDS provides for this case,
after a mouse click until the button blurs. Keyboard activation keeps
the focus text.

onMouseDown was only wired on the icon variants. Wire it on the text
variants too.
`disabled` only kept the menu closed; the input stayed enabled, so a
"disabled" combobox could still be focused and typed into. Only the
inline and readonly single-selection inputs could be disabled, through
`singleInputDisabled`.

`disabled` now disables the input in every variant. `singleInputDisabled`
is deprecated as an alias for `disabled` and warns once.
…put prop sets its own

The `input` element's props were spread last, so an `onChange` or
`inputRef` on it replaced the picker's. The picker then lost track of
typed text and of the input node, so closing the calendar could not
return focus to the input. Both are now composed: the consumer's runs,
then the picker's. Other `input` props still win.
The input's keydown handler called onChange for Enter and Space with a
KeyboardEvent cast to a ChangeEvent. Space already toggles a native
checkbox through its click, and Enter should not toggle a checkbox, so
remove the handler; onChange now only receives real change events.

readOnly was accepted but never applied. A read-only checkbox is now
announced with aria-readonly, stays focusable, and does not call
onChange, so the controlled `checked` does not change.

BREAKING CHANGE: Enter no longer toggles a Checkbox, and onChange is no
longer called with a KeyboardEvent. readOnly now blocks onChange.
… aria-describedby

An open composer behaves like a dialog, so when it mounts open, or the
parent opens it without a click, focus the role="dialog" section (now
tabIndex=-1). When it unmounts, return focus to the element that had it,
if the composer took focus and it has not moved elsewhere. A composer
that mounts minimized leaves focus alone.

The minimize and expand buttons replace each other, so clicking one
unmounted the focused button and focus fell to <body>. When the parent
accepts the request, focus now moves to the button that took its place.

aria-describedby pointed at the body id while closed, when the body is
not rendered. It is now only set while open.
…rendered

With isError, the filter button pointed aria-describedby at
`${id}-error`, which only exists when the Filter sits in a
PanelFilterList with errorLabel. PanelFilterList now provides the id of
the error element it renders through context, and the Filter only sets
aria-describedby when one exists.
The title was skipped with a truthiness check, so `title={0}` rendered
nothing. Only a missing or empty title is skipped now, and boolean
titles are treated as missing, as React does, so
`title={cond && 'Name'}` does not render an empty heading.
A link pill with labels.label renders an <a class="slds-pill__action">
inside a span with role="button", nesting one control in another. The
anchor is the control, matching the SLDS blueprint, so the span no longer
gets a role. A link pill without a label (content from children) has no
anchor and keeps role="button".
The trigger element was cloned with the popover's onFocus, onMouseDown,
onMouseEnter and onMouseLeave, replacing any the trigger set itself (or
setting them to undefined). They are now merged with mergeProps, so both
run. onClick already called the trigger's handler.

The trigger tabIndex default uses `??` instead of `||`. -1 already
worked (it is truthy); this only makes the intent explicit.
…ses onOpen or onClose

The rest props were spread onto Popover after EditDialog's own onOpen,
onClose and onRequestClose, so a consumer's handler replaced them and
EditDialog's internal open state stopped updating. The consumer's
handlers are now called from EditDialog's.
Tooltip and vertical label ids used `step.id || index`, so a step with
id 0 got its index instead. They now use `step.id ?? index`. This
changes the DOM ids of a step whose id is 0 and is not the first step.
Leaf items were keyed with generateId(), a new key on every render, so
every leaf remounted whenever the tree rendered (losing DOM focus and
any state). They are now keyed by node.id, like branches.
…ndow resize listener

`fixedLayout` no longer adds `slds-table_resizable-cols` (column resizing
was removed) or `role="grid"`. The table and its cells get the grid roles
only when `keyboardNavigation` is also on, since that is when arrow-key
cell navigation runs; a `gridcell` outside a `grid` is invalid ARIA.

Fixed headers now follow the scroller and table size through a
`ResizeObserver` instead of a `window` resize listener, so they also
reposition when the container resizes without the window. The window
listener stays as a fallback where `ResizeObserver` is missing.

`onFixedHeaderResize` and `onToggleFixedHeaderListeners` existed only to
replace that listener. They are deprecated with a warning and still
called until GA.
An item without `url` rendered `<a href="#">` and cancelled the click,
so screen readers announced a link that goes nowhere and middle-click
opened the page in a new tab. It now renders
`<button type="button" class="slds-button_reset slds-nav-vertical__action">`,
which keeps the SLDS look (checked in a browser test against the real
stylesheet) and is operable with Enter and Space. `NavigationItem.url`
is optional to match.

BREAKING CHANGE: `onSelect` receives `MouseEvent<HTMLAnchorElement | HTMLButtonElement>`;
handlers that annotate the event as an anchor event must widen the type.
Styles or selectors that target `a.slds-nav-vertical__action` need to
match the button for items without `url`.
Without `href` the link rendered an `<a>` with no `href`, which is not
focusable and has no link role. `href` is now required in the type and a
missing one warns once at runtime through a new `check-props.js`.

BREAKING CHANGE: `VisualPickerLink` requires `href`. Pass the link target;
an option that is not a link belongs in a `Checkbox` or `Radio` visual
picker instead.
`InfoBadge` always rendered the check icon, so screen readers announced
"Completed" on a badge that was not, and SLDS 1 hid it with CSS only
inside a complete progress block. The icon now renders only when
`isComplete` is set (the WelcomeMat sets it from its tiles).

The badge `<img>` keeps `alt=""` by default; the new
`assistiveText.image` gives it alt text when the image carries meaning.
@interactivellama
interactivellama force-pushed the feat/v11-p1-1-behavior-fixes branch from 91e8f60 to 34a128d Compare November 10, 2026 07:27
@interactivellama
interactivellama marked this pull request as ready for review November 10, 2026 08:00
@interactivellama
interactivellama merged commit d93da36 into master Nov 10, 2026
11 checks passed
@interactivellama
interactivellama deleted the feat/v11-p1-1-behavior-fixes branch November 10, 2026 19:32
interactivellama added a commit that referenced this pull request Nov 20, 2026
Make @typescript-eslint/consistent-type-assertions an error in components/
and utilities/ source. Casts hid real bugs during the v11 migration: a
ReactNode summary cast to string rendered an "[object Object]" tooltip in
AccordionPanel (#3253), and Checkbox called onChange with a KeyboardEvent
cast to a ChangeEvent (#3284).

Use assertionStyle 'never'. It still allows `as const`, which only narrows
a literal and cannot hide a mismatch, so 'never' is workable here. Allowing
object-literal assertions was not needed: `{} as T` is the shape that lets
a partial object pass as a complete one, and annotations or `satisfies`
cover the legitimate uses.

The 404 casts that predate the rule (110 files) are recorded in
eslint-suppressions.json with `--suppress-rule`, the mechanism the
no-deprecated rule uses. Pruning them is a GA item on the roadmap. Tests,
examples and stories are exempt.
interactivellama added a commit that referenced this pull request Nov 20, 2026
…an be

Radio calls onChange with the input's `change` event when a click selects
it, but with the `click` event when a click deselects a checked
`deselectable` radio (a checked radio fires no `change`), and with the
`keydown` event for Enter, and for Space on a checked `deselectable`
radio. Radio cast the click to a ChangeEvent, and RadioGroup cast Radio's
ChangeEvent | KeyboardEvent to a ChangeEvent, so RadioGroup and
RadioButtonGroup's `onChange` was typed as always getting a ChangeEvent.
This is the same mismatch as Checkbox's KeyboardEvent cast to a
ChangeEvent (#3284).

The events themselves predate v11: 0.10.x passed the click and keypress
events too, but it had no types. Unlike Checkbox, these keyboard and click
paths are real behavior (deselecting, and Enter to select), so the fix is
the type, not the handler.

Add RadioChangeEvent (ChangeEvent | MouseEvent | KeyboardEvent on the
input) and use it for Radio's and RadioGroup's onChange, and drop both
casts. ColorPicker's swatch toggle was the one internal handler typed for a
ChangeEvent only; it now reads `data.value`.

BREAKING CHANGE: RadioGroup and RadioButtonGroup's `onChange` event is
typed as `RadioChangeEvent`, and Radio's adds MouseEvent. A handler whose
event parameter is annotated as `ChangeEvent` no longer type-checks; read
the selection from `data.value`.
interactivellama added a commit that referenced this pull request Nov 20, 2026
…n the menu

When Enter, Space, Up or Down on the trigger opens the menu,
keyboardNavigate calls the context's handleClick with that keydown
event, and MenuDropdown passed it to `onClick` cast `as unknown as
MouseEvent`. So `onClick` was typed as always getting a MouseEvent, and a
handler reading `clientX` or `button` type-checked and got `undefined`
from the keyboard. This is the same KeyboardEvent-as-another-event cast
as Checkbox's (#3284). 0.10.x also called onClick with the keypress
event, but had no types.

Type `onClick`'s event as `MouseEvent | KeyboardEvent`, and build the
keyboard context where the keydown event is in scope, so handleClick
passes it through without a cast.

BREAKING CHANGE: MenuDropdown's `onClick` event is typed as
`MouseEvent | KeyboardEvent`. A handler whose event parameter is
annotated as `MouseEvent` no longer type-checks.
interactivellama added a commit that referenced this pull request Nov 20, 2026
Make @typescript-eslint/consistent-type-assertions an error in components/
and utilities/ source. Casts hid real bugs during the v11 migration: a
ReactNode summary cast to string rendered an "[object Object]" tooltip in
AccordionPanel (#3253), and Checkbox called onChange with a KeyboardEvent
cast to a ChangeEvent (#3284).

Use assertionStyle 'never'. It still allows `as const`, which only narrows
a literal and cannot hide a mismatch, so 'never' is workable here. Allowing
object-literal assertions was not needed: `{} as T` is the shape that lets
a partial object pass as a complete one, and annotations or `satisfies`
cover the legitimate uses.

The 404 casts that predate the rule (110 files) are recorded in
eslint-suppressions.json with `--suppress-rule`, the mechanism the
no-deprecated rule uses. Pruning them is a GA item on the roadmap. Tests,
examples and stories are exempt.
interactivellama added a commit that referenced this pull request Nov 24, 2026
…an be

Radio calls onChange with the input's `change` event when a click selects
it, but with the `click` event when a click deselects a checked
`deselectable` radio (a checked radio fires no `change`), and with the
`keydown` event for Enter, and for Space on a checked `deselectable`
radio. Radio cast the click to a ChangeEvent, and RadioGroup cast Radio's
ChangeEvent | KeyboardEvent to a ChangeEvent, so RadioGroup and
RadioButtonGroup's `onChange` was typed as always getting a ChangeEvent.
This is the same mismatch as Checkbox's KeyboardEvent cast to a
ChangeEvent (#3284).

The events themselves predate v11: 0.10.x passed the click and keypress
events too, but it had no types. Unlike Checkbox, these keyboard and click
paths are real behavior (deselecting, and Enter to select), so the fix is
the type, not the handler.

Add RadioChangeEvent (ChangeEvent | MouseEvent | KeyboardEvent on the
input) and use it for Radio's and RadioGroup's onChange, and drop both
casts. ColorPicker's swatch toggle was the one internal handler typed for a
ChangeEvent only; it now reads `data.value`.

BREAKING CHANGE: RadioGroup and RadioButtonGroup's `onChange` event is
typed as `RadioChangeEvent`, and Radio's adds MouseEvent. A handler whose
event parameter is annotated as `ChangeEvent` no longer type-checks; read
the selection from `data.value`.
interactivellama added a commit that referenced this pull request Nov 24, 2026
…n the menu

When Enter, Space, Up or Down on the trigger opens the menu,
keyboardNavigate calls the context's handleClick with that keydown
event, and MenuDropdown passed it to `onClick` cast `as unknown as
MouseEvent`. So `onClick` was typed as always getting a MouseEvent, and a
handler reading `clientX` or `button` type-checked and got `undefined`
from the keyboard. This is the same KeyboardEvent-as-another-event cast
as Checkbox's (#3284). 0.10.x also called onClick with the keypress
event, but had no types.

Type `onClick`'s event as `MouseEvent | KeyboardEvent`, and build the
keyboard context where the keydown event is in scope, so handleClick
passes it through without a cast.

BREAKING CHANGE: MenuDropdown's `onClick` event is typed as
`MouseEvent | KeyboardEvent`. A handler whose event parameter is
annotated as `MouseEvent` no longer type-checks.
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