Repository navigation
Description
Steps to reproduce
Steps:
- Open this link to live example: https://codesandbox.io/s/3fydl9 (preview: https://3fydl9.csb.app/). It has a left
SwipeableDrawerwithdisableSwipeToOpen={false},disableDiscovery,allowSwipeInChildrenandswipeAreaWidth={80}. The swipe area is shaded. - On iOS Safari (I used the iOS 18.3 Simulator in Xcode 16.2), tap the shaded strip without moving. Nothing happens, as expected.
- Tap the strip again, letting the finger move 1–2px, as a real tap does.
The page shows counters for touchmove events and for how often the page's scroll is locked while the drawer is closed.
Current behavior
On step 3, one touchmove of 1px reaches the drawer, and the drawer commits to a swipe. maybeSwiping is set, a temporary drawer renders open (open={variant === 'temporary' && maybeSwiping ? true : open}), the modal locks body scrolling, and the drawer starts to show. open stays false throughout. The "scroll locked while closed" counter goes up on every such tap.
In the source (packages/mui-material/src/SwipeableDrawer/SwipeableDrawer.js on master), handleBodyTouchMove calls startMaybeSwiping(true) before measuring how far the touch has moved, and force bypasses the disableDiscovery && allowSwipeInChildren deferral. That deferral exists so a tap doesn't change the DOM; the comment above it notes that Safari Mobile won't fire a click if the DOM changes during the touch. But any movement at all defeats it.
I couldn't reproduce this in Chrome's DevTools touch emulation, which sent no touchmove until the touch moved past its own touch slop (about 15px). Safari sends touchmove for movements of a pixel or two.
Expected behavior
A touch shouldn't set maybeSwiping, change the DOM, or lock scrolling until it has moved past a small tolerance (a touch slop, about 8–10px, as platforms use for taps). Below that, a tap should behave like a tap.
Context
An app that enables swipe-to-open on iOS (for example, a navigation drawer with a wide swipe area) sees the drawer flash and the page's scrolling lock briefly whenever a tap lands on the swipe area with normal finger movement.
A possible fix: in handleBodyTouchMove, measure the distance from the touch start first, and call startMaybeSwiping(true) only once it passes the tolerance. Using the same tolerance as the swipe threshold (UNCERTAINTY_THRESHOLD) would keep one setting for both. I'm happy to send a PR if this direction is welcome.
Related: #30762, which goes through the same startMaybeSwiping path.
Your environment
Versions
@mui/material: 9.5.0 (also seen with 9.4.0)
react, react-dom: ^19.1.0
@emotion/react, @emotion/styled: ^11.14.0
Browser: Safari, iOS 18.3 Simulator (Xcode 16.2, macOS)
Versions are from the linked sandbox. I haven't run npx @mui/envinfo there. Tested in the iOS Simulator; a check on a physical iPhone is still to do.
Search keywords: SwipeableDrawer, swipe area, tap, touchmove, startMaybeSwiping, disableDiscovery, allowSwipeInChildren, scroll lock, touch slop
Activity
ZeeshanTamboli commentedon Oct 28, 2026
I don't have Mac or Iphone so I can't test this.