Skip to content

feat: S2 DnD docs and followups#10082

Merged
LFDanLu merged 14 commits into
mainfrom
s2_dnd_followup
May 21, 2026
Merged

feat: S2 DnD docs and followups#10082
LFDanLu merged 14 commits into
mainfrom
s2_dnd_followup

Conversation

@LFDanLu
Copy link
Copy Markdown
Member

@LFDanLu LFDanLu commented May 19, 2026

Follow ups from testing and PR review:

  • Adds S2 DnD docs, basically same content as RAC DnD docs minus insertion indicator styling/ListBox/etc
  • Unifies InsertionIndicator and DragHandle implementations (uses SVG for InsertionIndicator, DragHandle needed the addition of isFocusVisibleWithinRow to TableCell renderProps and isFocusVisibleWithin for GridRow)
  • Adds DnD components to test apps
  • various small fixes (miscentered drag handle in iOS safari, row fill color in TableView highlight selection when dropping on row, etc)

✅ Pull Request Checklist:

  • Included link to corresponding React Spectrum GitHub Issue.
  • Added/updated unit tests and storybook for this change (for new code or code which already has tests).
  • Filled out test instructions.
  • Updated documentation (if it already exists for this component).
  • Looked at the Accessibility Practices for this feature - Aria Practices

📝 Test Instructions:

Go through the S2 DnD docs and verify things look fine. Smoke test DnD insertion indicators styling/appearance/positioning and that drag handles are properly visually hidden still and other mentioned bugs in description. Test DnD component in test apps (see fece8b9#comments for links)

See chromatic: https://www.chromatic.com/build?appId=5f0dd5ad2b5fc10022a2e320&number=1198

🧢 Your Project:

RSP

@rspbot
Copy link
Copy Markdown

rspbot commented May 19, 2026

@rspbot
Copy link
Copy Markdown

rspbot commented May 19, 2026

1 similar comment
@rspbot
Copy link
Copy Markdown

rspbot commented May 19, 2026

LFDanLu added 4 commits May 19, 2026 16:15
done via isFocusVisibleWithinRow render prop support in TableCells and isFocusVisibleWithin render prop support in GridList row
@LFDanLu LFDanLu marked this pull request as ready for review May 20, 2026 22:46
@LFDanLu LFDanLu changed the title feat: (WIP) S2 DnD docs and followups feat: S2 DnD docs and followups May 20, 2026
@rspbot
Copy link
Copy Markdown

rspbot commented May 20, 2026

Comment on lines +451 to +456
/**
* Whether the item's children have keyboard focus.
*
* @selector [data-focus-visible-within]
*/
isFocusVisibleWithin: boolean;
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is really just parity with TableRow and TreeItemContent, and lets me get rid of a useFocusRing in S2 TreeView in favor of calling it here

Comment on lines +2011 to +2016
/**
* Whether keyboard focus is visible anywhere within the parent row.
*
* @selector [data-focus-visible-within-row]
*/
isFocusVisibleWithinRow: boolean;
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For discussion. As mentioned TableRow is a bit different from GridRow/TreeItemContent since it expects Cells as direct children and doesn't support a render prop render function. This means if we want the drag handle to be visible when focus is in the TableRow we can either do a css selector strat looking for the isFocusVisible data attribute or pass that state down to the Cells as well so the Cell render prop has this information to pass to its children

}

&[data-layout='grid']:not(:has(.react-aria-GridListSection)) {
&[data-layout='grid']:not(:has(.react-aria-GridListSection)):not([data-empty]) {
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

display: grid was overriding the empty state styles and thus breaking the text centering for empty state

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changes in here actually bring us back to main's original state, my dnd PR has a left over change from when the drop insertion indicators were reserving a non 0 height in the layout

Node
} from '@react-types/shared';
import DragHandle from '../ui-icons/DragHandle';
import {DragHandleButton} from './dnd-utils';
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
import {DragHandleButton} from './dnd-utils';
import {DragHandleButton, InsertionIndicator} from './dnd-utils';

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

derp, thanks

import {GridNode} from 'react-stately/private/grid/GridCollection';
import {IconContext} from './Icon';
import {InsertionIndicator} from './ListView';
import {InsertionIndicator} from './dnd-utils';
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
import {InsertionIndicator} from './dnd-utils';

snowystinger
snowystinger previously approved these changes May 21, 2026
Copy link
Copy Markdown
Member

@snowystinger snowystinger left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tested on chrome and ios, looks good

@rspbot
Copy link
Copy Markdown

rspbot commented May 21, 2026

@rspbot
Copy link
Copy Markdown

rspbot commented May 21, 2026

## API Changes

react-aria-components

/react-aria-components:GridListItemRenderProps

 GridListItemRenderProps {
   allowsDragging?: boolean
   id?: Key
   isDisabled: boolean
   isDragging?: boolean
   isDropTarget?: boolean
   isFocusVisible: boolean
+  isFocusVisibleWithin: boolean
   isFocused: boolean
   isHovered: boolean
   isPressed: boolean
   isSelected: boolean
   selectionMode: SelectionMode
   state: ListState<unknown>
 }

/react-aria-components:CellRenderProps

 CellRenderProps {
   columnIndex?: number | null
   hasChildItems: boolean
   id?: Key
   isDisabled: boolean
   isExpanded: boolean
   isFocusVisible: boolean
+  isFocusVisibleWithinRow: boolean
   isFocused: boolean
   isHovered: boolean
   isPressed: boolean
   isSelected: boolean
   level: number
 }

@rspbot
Copy link
Copy Markdown

rspbot commented May 21, 2026

Agent Skills Changes

Added (1)
Removed (116)
  • s2/skills/react-spectrum-s2/references/guides/test-utils-guidance.md
  • s2/skills/react-spectrum-s2/references/react-aria/components/Autocomplete.md
  • s2/skills/react-spectrum-s2/references/react-aria/components/Breadcrumbs.md
  • s2/skills/react-spectrum-s2/references/react-aria/components/Button.md
  • s2/skills/react-spectrum-s2/references/react-aria/components/Calendar.md
  • s2/skills/react-spectrum-s2/references/react-aria/components/Checkbox.md
  • s2/skills/react-spectrum-s2/references/react-aria/components/CheckboxGroup.md
  • s2/skills/react-spectrum-s2/references/react-aria/components/ColorArea.md
  • s2/skills/react-spectrum-s2/references/react-aria/components/ColorField.md
  • s2/skills/react-spectrum-s2/references/react-aria/components/ColorPicker.md
  • s2/skills/react-spectrum-s2/references/react-aria/components/ColorSlider.md
  • s2/skills/react-spectrum-s2/references/react-aria/components/ColorSwatch.md
  • s2/skills/react-spectrum-s2/references/react-aria/components/ColorSwatchPicker.md
  • s2/skills/react-spectrum-s2/references/react-aria/components/ColorWheel.md
  • s2/skills/react-spectrum-s2/references/react-aria/components/ComboBox.md
  • s2/skills/react-spectrum-s2/references/react-aria/components/DateField.md
  • s2/skills/react-spectrum-s2/references/react-aria/components/DatePicker.md
  • s2/skills/react-spectrum-s2/references/react-aria/components/DateRangePicker.md
  • s2/skills/react-spectrum-s2/references/react-aria/components/Disclosure.md
  • s2/skills/react-spectrum-s2/references/react-aria/components/DisclosureGroup.md
  • s2/skills/react-spectrum-s2/references/react-aria/components/DropZone.md
  • s2/skills/react-spectrum-s2/references/react-aria/components/FileTrigger.md
  • s2/skills/react-spectrum-s2/references/react-aria/components/Form.md
  • s2/skills/react-spectrum-s2/references/react-aria/components/GridList.md
  • s2/skills/react-spectrum-s2/references/react-aria/components/Group.md
  • s2/skills/react-spectrum-s2/references/react-aria/components/Link.md
  • s2/skills/react-spectrum-s2/references/react-aria/components/ListBox.md
  • s2/skills/react-spectrum-s2/references/react-aria/components/Menu.md
  • s2/skills/react-spectrum-s2/references/react-aria/components/Meter.md
  • s2/skills/react-spectrum-s2/references/react-aria/components/Modal.md
  • s2/skills/react-spectrum-s2/references/react-aria/components/NumberField.md
  • s2/skills/react-spectrum-s2/references/react-aria/components/Popover.md
  • s2/skills/react-spectrum-s2/references/react-aria/components/ProgressBar.md
  • s2/skills/react-spectrum-s2/references/react-aria/components/RadioGroup.md
  • s2/skills/react-spectrum-s2/references/react-aria/components/RangeCalendar.md
  • s2/skills/react-spectrum-s2/references/react-aria/components/SearchField.md
  • s2/skills/react-spectrum-s2/references/react-aria/components/Select.md
  • s2/skills/react-spectrum-s2/references/react-aria/components/Separator.md
  • s2/skills/react-spectrum-s2/references/react-aria/components/Slider.md
  • s2/skills/react-spectrum-s2/references/react-aria/components/Switch.md
  • s2/skills/react-spectrum-s2/references/react-aria/components/Table.md
  • s2/skills/react-spectrum-s2/references/react-aria/components/Tabs.md
  • s2/skills/react-spectrum-s2/references/react-aria/components/TagGroup.md
  • s2/skills/react-spectrum-s2/references/react-aria/components/TextField.md
  • s2/skills/react-spectrum-s2/references/react-aria/components/TimeField.md
  • s2/skills/react-spectrum-s2/references/react-aria/components/Toast.md
  • s2/skills/react-spectrum-s2/references/react-aria/components/ToggleButton.md
  • s2/skills/react-spectrum-s2/references/react-aria/components/ToggleButtonGroup.md
  • s2/skills/react-spectrum-s2/references/react-aria/components/Toolbar.md
  • s2/skills/react-spectrum-s2/references/react-aria/components/Tooltip.md
  • s2/skills/react-spectrum-s2/references/react-aria/components/Tree.md
  • s2/skills/react-spectrum-s2/references/react-aria/components/Virtualizer.md
  • s2/skills/react-spectrum-s2/references/react-aria/guides/ai.md
  • s2/skills/react-spectrum-s2/references/react-aria/guides/collections.md
  • s2/skills/react-spectrum-s2/references/react-aria/guides/customization.md
  • s2/skills/react-spectrum-s2/references/react-aria/guides/dnd.md
  • s2/skills/react-spectrum-s2/references/react-aria/guides/forms.md
  • s2/skills/react-spectrum-s2/references/react-aria/guides/frameworks.md
  • s2/skills/react-spectrum-s2/references/react-aria/guides/getting-started.md
  • s2/skills/react-spectrum-s2/references/react-aria/guides/quality.md
  • s2/skills/react-spectrum-s2/references/react-aria/guides/selection.md
  • s2/skills/react-spectrum-s2/references/react-aria/guides/styling.md
  • s2/skills/react-spectrum-s2/references/react-aria/guides/testing.md
  • s2/skills/react-spectrum-s2/references/react-aria/interactions/FocusRing.md
  • s2/skills/react-spectrum-s2/references/react-aria/interactions/FocusScope.md
  • s2/skills/react-spectrum-s2/references/react-aria/interactions/useClipboard.md
  • s2/skills/react-spectrum-s2/references/react-aria/interactions/useDrag.md
  • s2/skills/react-spectrum-s2/references/react-aria/interactions/useDrop.md
  • s2/skills/react-spectrum-s2/references/react-aria/interactions/useFocus.md
  • s2/skills/react-spectrum-s2/references/react-aria/interactions/useFocusRing.md
  • s2/skills/react-spectrum-s2/references/react-aria/interactions/useFocusVisible.md
  • s2/skills/react-spectrum-s2/references/react-aria/interactions/useFocusWithin.md
  • s2/skills/react-spectrum-s2/references/react-aria/interactions/useHover.md
  • s2/skills/react-spectrum-s2/references/react-aria/interactions/useKeyboard.md
  • s2/skills/react-spectrum-s2/references/react-aria/interactions/useLandmark.md
  • s2/skills/react-spectrum-s2/references/react-aria/interactions/useLongPress.md
  • s2/skills/react-spectrum-s2/references/react-aria/interactions/useMove.md
  • s2/skills/react-spectrum-s2/references/react-aria/interactions/usePress.md
  • s2/skills/react-spectrum-s2/references/react-aria/internationalized/date/Calendar.md
  • s2/skills/react-spectrum-s2/references/react-aria/internationalized/date/CalendarDate.md
  • s2/skills/react-spectrum-s2/references/react-aria/internationalized/date/CalendarDateTime.md
  • s2/skills/react-spectrum-s2/references/react-aria/internationalized/date/DateFormatter.md
  • s2/skills/react-spectrum-s2/references/react-aria/internationalized/date/Time.md
  • s2/skills/react-spectrum-s2/references/react-aria/internationalized/date/ZonedDateTime.md
  • s2/skills/react-spectrum-s2/references/react-aria/internationalized/date/index.md
  • s2/skills/react-spectrum-s2/references/react-aria/internationalized/number/NumberFormatter.md
  • s2/skills/react-spectrum-s2/references/react-aria/internationalized/number/NumberParser.md
  • s2/skills/react-spectrum-s2/references/react-aria/internationalized/number/index.md
  • s2/skills/react-spectrum-s2/references/react-aria/llms.txt
  • s2/skills/react-spectrum-s2/references/react-aria/testing/CheckboxGroup/testing.md
  • s2/skills/react-spectrum-s2/references/react-aria/testing/ComboBox/testing.md
  • s2/skills/react-spectrum-s2/references/react-aria/testing/GridList/testing.md
  • s2/skills/react-spectrum-s2/references/react-aria/testing/ListBox/testing.md
  • s2/skills/react-spectrum-s2/references/react-aria/testing/Menu/testing.md
  • s2/skills/react-spectrum-s2/references/react-aria/testing/Modal/testing.md
  • s2/skills/react-spectrum-s2/references/react-aria/testing/Popover/testing.md
  • s2/skills/react-spectrum-s2/references/react-aria/testing/RadioGroup/testing.md
  • s2/skills/react-spectrum-s2/references/react-aria/testing/Select/testing.md
  • s2/skills/react-spectrum-s2/references/react-aria/testing/Table/testing.md
  • s2/skills/react-spectrum-s2/references/react-aria/testing/Tabs/testing.md
  • s2/skills/react-spectrum-s2/references/react-aria/testing/Tree/testing.md
  • s2/skills/react-spectrum-s2/references/react-aria/utilities/I18nProvider.md
  • s2/skills/react-spectrum-s2/references/react-aria/utilities/PortalProvider.md
  • s2/skills/react-spectrum-s2/references/react-aria/utilities/SSRProvider.md
  • s2/skills/react-spectrum-s2/references/react-aria/utilities/VisuallyHidden.md
  • s2/skills/react-spectrum-s2/references/react-aria/utilities/mergeProps.md
  • s2/skills/react-spectrum-s2/references/react-aria/utilities/useCollator.md
  • s2/skills/react-spectrum-s2/references/react-aria/utilities/useDateFormatter.md
  • s2/skills/react-spectrum-s2/references/react-aria/utilities/useField.md
  • s2/skills/react-spectrum-s2/references/react-aria/utilities/useFilter.md
  • s2/skills/react-spectrum-s2/references/react-aria/utilities/useId.md
  • s2/skills/react-spectrum-s2/references/react-aria/utilities/useIsSSR.md
  • s2/skills/react-spectrum-s2/references/react-aria/utilities/useLabel.md
  • s2/skills/react-spectrum-s2/references/react-aria/utilities/useLocale.md
  • s2/skills/react-spectrum-s2/references/react-aria/utilities/useNumberFormatter.md
  • s2/skills/react-spectrum-s2/references/react-aria/utilities/useObjectRef.md
Modified (143)
Install

React Spectrum S2:

npx skills add https://d1pzu54gtk2aed.cloudfront.net/pr/5313011065072f17ad348f4f9c942f1fa24e2fdf/

React Aria:

npx skills add https://d5iwopk28bdhl.cloudfront.net/pr/5313011065072f17ad348f4f9c942f1fa24e2fdf/

Copy link
Copy Markdown
Member

@reidbarber reidbarber left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@LFDanLu LFDanLu added this pull request to the merge queue May 21, 2026
Merged via the queue into main with commit b876c90 May 21, 2026
30 checks passed
@LFDanLu LFDanLu deleted the s2_dnd_followup branch May 21, 2026 18:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants