Skip to content

feat(draggable): align component with fusion designs - #8284

Merged
edleeks87 merged 1 commit into
masterfrom
draggable-alignment
Dec 4, 2026
Merged

edleeks87 merged 1 commit into
masterfrom
draggable-alignment

Conversation

@edleeks87

@edleeks87 edleeks87 commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Proposed behaviour

Updates component to support new fusion styling:

  • adds ghost element when target is dragged
  • adds drop target key line indicator that intuitively renders depending on direction of drag

Surfaces new custom hook that allows any element to be passed into DraggableItem and have the DragHandle and the accessible alternative callbacks etc. Deprecated draggable props in favour of this approach

Adds examples of draggable Tiles and Cards

Table has not been update as it relies on slightly different styling/behaviour

Current behaviour

No support for ghost element when target is dragged
No drop target key line
No custom hook to support draggable custom elements

Checklist

  • Commits follow our style guide
  • Unit tests added or updated if required
  • Playwright automation tests added or updated if required
  • Storybook added or updated if required
  • Typescript d.ts file added or updated if required

QA

  • Tested in provided StackBlitz sandbox/Storybook
  • Add new Playwright test coverage if required
  • Carbon implementation matches Design System/designs
  • UI Tests GitHub check reviewed if required

Additional context

Testing instructions

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

Integrated handles override explicit vertical padding, unbatched reorders can lose or misdirect focus, and the Tile example lacks an accessible non-drag reorder path.

3 open issues
What changed in this PR

Aligns Carbon’s draggable components with Fusion designs and adds a shared integration for Cards, Tiles, and custom components.

Changes:

  • Adds surface-matched drag ghosts, directional drop indicators, and handle-only dragging.
  • Exposes DragHandle and useDraggableItemContext, including manual reordering, and deprecates Card’s draggable prop.
  • Expands examples, accessibility guidance, generated references, and unit/browser coverage.
File Description
src/​components/​tile/​tile.test.tsx Tests handle integration and reorder-control slots.
src/​components/​tile/​tile.style.ts Adds draggable layout while preserving horizontal content.
src/​components/​tile/​tile.stories.tsx Adds a draggable Tile example.
src/​components/​tile/​tile.mdx Documents draggable Tiles and reorder controls.
src/​components/​tile/​tile.component.tsx Registers the surface and renders handles and controls.
src/​components/​draggable/​use-draggable-item-context.ts Exposes surface registration and manual reordering.
src/​components/​draggable/​index.ts Exports the public hook and handle APIs.
src/​components/​draggable/​draggable.test.tsx Tests ordering, registration, and component integration.
src/​components/​draggable/​draggable.stories.tsx Demonstrates Cards, Tiles, custom panels, and accessible controls.
src/​components/​draggable/​draggable.pw.tsx Covers browser dragging, geometry, keyboard controls, and focus.
src/​components/​draggable/​draggable.mdx Documents integration, accessibility, and testing.
src/​components/​draggable/​draggable-item/​draggable-item.style.ts Styles ghosts, indicators, and shared handles.
src/​components/​draggable/​draggable-item/​draggable-item.component.tsx Coordinates registered surfaces, handles, and item context.
src/​components/​draggable/​draggable-container.component.tsx Supports layout wrappers, shared ordering, and focus restoration.
src/​components/​draggable/​drag-handle/​index.ts Exports the handle component and props.
src/​components/​draggable/​drag-handle/​drag-handle.component.tsx Implements the reusable, context-registered handle.
src/​components/​draggable/​components.test-pw.tsx Adds browser-test fixtures for integrated components.
src/​components/​draggable/​__internal__/​use-draggable-item.ts Encapsulates native drag registration and visual state.
src/​components/​draggable/​__internal__/​drop-indicator.ts Calculates indicator direction and rounded-corner offsets.
src/​components/​draggable/​__internal__/​drop-indicator.test.ts Tests indicator positioning and corner geometry.
src/​components/​draggable/​__internal__/​draggable-item.context.ts Defines internal registration and reorder context.
src/​components/​draggable/​__internal__/​drag-surface.ts Resolves surfaces and captures ghost geometry.
src/​components/​draggable/​__internal__/​drag-surface.test.ts Tests surface selection and ghost dimensions.
src/​components/​draggable/​__internal__/​data.ts Carries registered surfaces in drag data.
src/​components/​card/​card.test.tsx Updates the shared handle-style import.
src/​components/​card/​card.style.ts Centers drag-row controls and removes duplicate handle styling.
src/​components/​card/​card.mdx Documents automatic draggable integration.
src/​components/​card/​card.component.tsx Integrates the shared handle and deprecates draggable.
skills/​carbon-react/​components/​tile.md Updates generated Tile props and examples.
skills/​carbon-react/​components/​draggable-item.md Updates generated item API references.
skills/​carbon-react/​components/​draggable-container.md Updates generated container API references.
skills/​carbon-react/​components/​card.md Records the Card prop deprecation.

Review effort: Balanced

Comment thread src/components/tile/tile.stories.tsx Resolved
@ljemmo
ljemmo marked this pull request as ready for review November 12, 2026 11:19
@ljemmo
ljemmo requested review from a team as code owners November 12, 2026 11:19
@edleeks87
edleeks87 force-pushed the draggable-alignment branch 2 times, most recently from 491cd69 to 1d6fc78 Compare November 18, 2026 15:05
@edleeks87
edleeks87 requested a balanced review from Copilot November 18, 2026 15:10
@edleeks87
edleeks87 marked this pull request as draft November 18, 2026 15:17

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

Nested Card/Tile compositions allow the inner Tile to overwrite and clear shared draggable registration, leaving the outer Card’s handle unable to drag.

3 open issues
3 resolved since last review

Review effort: Balanced

Comment thread skills/carbon-react/components/tile.md Resolved
Comment thread src/components/tile/tile.stories.tsx Resolved
@ibutakova
ibutakova self-requested a review November 19, 2026 16:20
Comment thread src/components/card/card.mdx Resolved
Comment thread src/components/card/card.component.tsx Resolved
@ibutakova

Copy link
Copy Markdown
Contributor

Huge work you have out into this PR! Just a few small things to consider before wrapping it up:

  1. Looks we do not use @atlaskit/pragmatic-drag-and-drop-hitbox anymore. Should we drop the package?
  2. Not sure it is intended but DragHandle, DragHandleProps are exported from draggable/index.ts but not added to src/index. As well as some other props and components.
  3. DraggableContainer and DraggableItem now accept every html attribute, onDrop, onDragStart, etc. Potential clash.
  4. After an item moves between grouped containers, it stops receiving prop updates unless the parent moves it between its own lists in getOrder. Should we resolve the moved item from latest children across group or documentthat containers must be controlled and provide a story?
  5. I do not now if we have use cases with large lists, let's say 100+ items, but if so, we should not measure the whole list on every pointer move. Otherwise it is negligible.

@edleeks87
edleeks87 requested review from tomdavies73 and removed request for tomdavies73 November 20, 2026 13:06
@DipperTheDan
DipperTheDan self-requested a review November 24, 2026 14:25

@DipperTheDan DipperTheDan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nothing more to add from me.

@edleeks87
edleeks87 marked this pull request as ready for review November 26, 2026 13:06
@damienrobson-sage

Copy link
Copy Markdown
Contributor

Looks good to me.

Might want to create a region internal to the DraggableContainer to handle the announcements of items being moved; as teams start implementing it's likely to become a request from use to save repeating the same advice constantly and teams implementing it in different ways. But not absolutely essential for a day 0 release, as you've covered off an alternative solution in the documentation.

@ljemmo

ljemmo commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

Reviewed from a UX POV and LGTM.

@edleeks87
edleeks87 dismissed stale reviews from ibutakova and DipperTheDan via 9a00fa3 December 4, 2026 12:58
@edleeks87
edleeks87 force-pushed the draggable-alignment branch 4 times, most recently from 3016171 to cef0b5c Compare December 4, 2026 13:13
ibutakova
ibutakova previously approved these changes Dec 4, 2026
DipperTheDan
DipperTheDan previously approved these changes Dec 4, 2026
@edleeks87
edleeks87 dismissed stale reviews from DipperTheDan and ibutakova via 94e19e2 December 4, 2026 15:15
@edleeks87
edleeks87 force-pushed the draggable-alignment branch from cef0b5c to 94e19e2 Compare December 4, 2026 15:15
@edleeks87
edleeks87 marked this pull request as draft December 4, 2026 15:40
@edleeks87
edleeks87 marked this pull request as ready for review December 4, 2026 15:40
@edleeks87
edleeks87 merged commit 8bf07a2 into master Dec 4, 2026
68 of 69 checks passed
@edleeks87
edleeks87 deleted the draggable-alignment branch December 4, 2026 15:46
@carbonci

carbonci commented Dec 4, 2026

Copy link
Copy Markdown
Collaborator

🎉 This PR is included in version 164.5.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

9 participants