Skip to content

feat(drag-and-drop): add shadowDragHandle support for Shadow DOM handle matching#172

Open
driskull wants to merge 1 commit into
formkit:mainfrom
driskull:dris0000/shadow-drag-handle
Open

feat(drag-and-drop): add shadowDragHandle support for Shadow DOM handle matching#172
driskull wants to merge 1 commit into
formkit:mainfrom
driskull:dris0000/shadow-drag-handle

Conversation

@driskull
Copy link
Copy Markdown

@driskull driskull commented May 19, 2026

Summary

This PR adds support for a new config option, shadowDragHandle, to enable drag handle matching inside Shadow DOM using event composedPath traversal.

What Changed

  • Added shadowDragHandle to parent configuration types.
  • Updated drag handle validation to:
    • Prefer shadowDragHandle when provided.
    • Match selectors against the event composedPath.
    • Skip querySelector-based matching in that mode.
  • Kept existing behavior for dragHandle unchanged when shadowDragHandle is not set.
  • Added end-to-end test coverage for:
    • Native drag behavior with shadow-based handles.
    • Synthetic drag behavior with shadow-based handles.
    • Negative path where dragging from non-handle areas is rejected.
    • Precedence path showing shadowDragHandle is used instead of dragHandle selector matching.
  • Updated test utilities to reliably target elements in open Shadow roots and dispatch composed events where needed.

Why

Selector matching via querySelector cannot traverse into Shadow DOM internals. Matching with composedPath enables reliable drag-handle validation for web components and encapsulated UI.

Testing Notes

  • Added targeted Playwright scenarios for both desktop native drag and mobile synthetic drag flows.

#170

@vercel
Copy link
Copy Markdown

vercel Bot commented May 19, 2026

@driskull is attempting to deploy a commit to the Formkit Team on Vercel.

A member of the Team first needs to authorize it.

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.

1 participant