From a646a8a197d4c5bff4b832399b3ac6c4e6ea04bd Mon Sep 17 00:00:00 2001 From: Matt Perry Date: Mon, 5 Jan 2026 18:08:47 +0100 Subject: [PATCH 1/5] Fix drag gesture triggering on interactive elements inside draggables MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Prevents drag from starting when clicking on input, textarea, select, button, anchor, or contenteditable elements inside a draggable component. This allows normal interaction with form elements (focus, text selection) without triggering the parent's drag gesture. Fixes #1674 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- CLAUDE.md | 2 + .../src/tests/drag-input-propagation.tsx | 48 ++++++++++ .../integration/drag-input-propagation.ts | 87 +++++++++++++++++++ .../drag/VisualElementDragControls.ts | 31 ++++++- 4 files changed, 167 insertions(+), 1 deletion(-) create mode 100644 dev/react/src/tests/drag-input-propagation.tsx create mode 100644 packages/framer-motion/cypress/integration/drag-input-propagation.ts diff --git a/CLAUDE.md b/CLAUDE.md index a7987720b3..fe6d39bc11 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -73,6 +73,8 @@ motion (public API) ## Writing Tests +**IMPORTANT: Always write a failing test FIRST before implementing any bug fix or feature.** This ensures the issue is reproducible and the fix is verified. For UI interaction bugs (like gesture handling), prefer E2E tests using Playwright or Cypress. + When waiting for the next frame in async tests: ```javascript diff --git a/dev/react/src/tests/drag-input-propagation.tsx b/dev/react/src/tests/drag-input-propagation.tsx new file mode 100644 index 0000000000..ec3d2396bd --- /dev/null +++ b/dev/react/src/tests/drag-input-propagation.tsx @@ -0,0 +1,48 @@ +import { motion } from "framer-motion" + +/** + * Test page for issue #1674: Inputs inside draggable elements should not trigger drag + * when clicked/interacted with. + */ +export const App = () => { + return ( +
+ + +