Repository navigation
fix(Drawer): let touch swipes start on interactive elements - #2982
Conversation
Touch swipes skipped buttons, links, labels and fields, so drawers built from them (nav links, action sheets, checkbox rows) could not be dragged. Port Base UI's behavior: touch ignores the interactive-element selector (`ignoreSelectorWhenTouch: false`) and only keeps range inputs out, while mouse and pen still skip interactive elements. Add `data-reka-swipe-ignore` to opt an element out for every input type (mui/base-ui#4295). Closes #2907 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: unovue/reka-ui/.coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (4)
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 5 remain after this review. 📝 WalkthroughWalkthroughDrawer swipe-dismiss now allows touch swipes to start on most interactive content, while continuing to exclude range inputs and elements marked with ChangesDrawer swipe start rules
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~12 minutes Change: Bug fix · Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to The change enables touch swipes on interactive Drawer content while retaining pointer exclusions and explicit opt-outs. No concrete merge-blocking issue is established; merge after normal checks. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to This is a narrowly scoped interaction change. Existing dismissal guards, range-input protection, and explicit swipe exclusions remain. No privilege or data-access expansion was identified, but concurrent-touch and browser-specific click behavior remain partially verified. Retained concerns Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
Resilience and Maintainability Implications
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 8 functions across 2 files. (2 skipped: 2 unsupported.)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
commit: |
🔗 Linked issue
Closes #2907
❓ Type of change
📚 Description
useSwipeDismissskipped any touch that started on abutton,a,label, field or[role="button"]. A drawer made mostly of these (a nav list, an action sheet, checkbox rows) could barely be dragged on touch devices.This PR ports what Base UI does (mui/base-ui#4295). Base UI's
DrawerViewportpassesignoreSelectorWhenTouch: false:data-reka-swipe-ignore(the equivalent ofdata-base-ui-swipe-ignore) stops a swipe from starting on an element and its children, for every input type. Use it for carousels, maps, signature pads and similar controls.I didn't add a configurable selector prop or make
canStartable to force a swipe, both of which the issue suggested. Base UI has neither, and the touch change plus the opt-out attribute cover the cases in the issue.Docs: a new "Where a swipe can start" example in the Drawer page.
Tests: new
useSwipeDismisscases check that:data-reka-swipe-ignoresubtree is left to the elementOn the old code, the link, button, label and ignore-attribute cases fail.
📝 Checklist
🤖 Generated with Claude Code
Summary by CodeRabbit
data-reka-swipe-ignoreto prevent swipe gestures from starting on an element, regardless of input type.