-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
fix: allow drag to start from child button and link elements #3519
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Child buttons and links no longer block drag gestures from starting since they don't have click-and-move actions of their own. Only form controls where text selection or direct interaction is expected (input, textarea, select) will still block drag. https://claude.ai/code/session_01YKHLcB3ZviYXCsrWZzmyou
Code ReviewSummaryThis PR fixes an issue where drag gestures couldn't start from child button and link elements. The change refines the logic for determining which elements should block drag gestures, limiting it to form controls with text selection/interaction (input, textarea, select) and excluding buttons and links. ✅ Strengths1. Well-reasoned behavior change 2. Excellent test coverage
3. Clear documentation 4. Follows project conventions
🔍 Observations & Considerations1. Potential edge case: contentEditable 2. Accessibility implications
However, the PR description suggests this is intentional since buttons/links "don't have click-and-move actions of their own." 3. Impact on
4. Test organization 🐛 Potential IssuesMinor: Test naming consistency 🎯 Recommendations1. Consider E2E tests (Optional) While the Jest tests are thorough, a Playwright test would verify real browser behavior, especially for edge cases like:
2. Verify all input types (Optional) 3. Document breaking change
🏁 VerdictApprove with minor suggestions. The code quality is high, test coverage is comprehensive, and the behavioral change is well-reasoned for common UI patterns. The concerns raised are edge cases that may not warrant blocking this PR, but are worth considering for future refinement. Security: ✅ No concerns Great work! 🎉 |
Update the Cypress tests to expect drag to work when clicking on child button and link elements, matching the updated behavior. https://claude.ai/code/session_01YKHLcB3ZviYXCsrWZzmyou
Code Review: Allow drag to start from child button and link elementsSummaryThis PR changes the drag behavior to allow dragging when initiated from child ✅ Strengths
🔍 Potential Issues & Considerations1. Edge Case: Elements with
|
Create isElementTextInput for drag blocking (input/textarea/select) while preserving isElementKeyboardAccessible with button/link for the press gesture's tabIndex logic. https://claude.ai/code/session_01YKHLcB3ZviYXCsrWZzmyou
Code ReviewSummaryThis PR improves the drag gesture behavior by allowing drag to start from child button and link elements, while still blocking drag from form controls (input, textarea, select, contenteditable). This is a sensible UX improvement since buttons and links don't have click-and-move interactions. ✅ Strengths1. Well-justified behavioral change 2. Excellent test coverage
3. Clear separation of concerns
4. Good documentation 🔍 Potential Issues1. Missing contenteditable test coverage test("drag gesture does not start when clicking a child contenteditable", async () => {
// ... test implementation
<div data-testid="child-editable" contentEditable="true">
Edit me
</div>
})2. Event propagation considerations <motion.div drag>
<div>
<input /> {/* Will this be blocked? */}
</div>
</motion.div>The current implementation should handle this correctly since 3. Potential edge case: button/link inside input label <motion.div drag>
<label>
<input type="checkbox" />
<button>Click me</button>
</label>
</motion.div>If users click the button, should drag start? The current implementation will allow it, which seems reasonable, but worth considering if this could lead to unexpected behavior. 🎯 RecommendationsLow priority:
Documentation: 🔒 Security & Performance
📊 Overall AssessmentThis is a high-quality PR with:
The suggestions above are minor improvements. The core change is solid and ready to merge pending any final discussion about the contenteditable test coverage. Recommendation: Approve with minor suggestions ✅ Note: Tests were reviewed statically. Consider running the full test suite to verify all tests pass. |
Child buttons and links no longer block drag gestures from starting
since they don't have click-and-move actions of their own. Only form
controls where text selection or direct interaction is expected
(input, textarea, select) will still block drag.
https://claude.ai/code/session_01YKHLcB3ZviYXCsrWZzmyou