mui / mui/material-ui

[SwipeableDrawer] Swipe to close only works on touch devices

Open
#35,680 4 comments 47 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

component: SwipeableDrawer scope: drawer type: new feature waiting for 👍
Dominant language
JavaScript
Stars
99.1k
Forks
32.5k
Avg merge
2d 17h
Merged PRs (30d)
106

Description

Duplicates
  • I have searched the existing issues
Latest version
  • I have tested the latest version
Steps to reproduce 🕹

Link to live example: https://codesandbox.io/s/flamboyant-fast-3ynzp2?file=/src/App.tsx

Steps:

  1. Open the link above in a browser (not on mobile!)
  2. Click on the "open" button
  3. Try to drag down the drawer to dismiss it
Current behavior 😯

A drawer will appear which cannot be dismissed by dragging it down, this is only possible for devices which have touch targets (so basically mobile).

Expected behavior 🤔

When using the SwipeableDrawer, I would expect the drawer to be swipeable whether I am on a touch target device or when I'm using it on a desktop.

Context 🔦

I use the SwipeableDrawer to create a Material Bottom Sheet, where I would like to dismiss the sheet by dragging it down, whether I'm using a phone or a desktop. I noticed that users are trying to drag down the sheet (which is expected because we are providing a "handle") but they are unable to do so because they are using it on a desktop.

Your environment 🌎
npx @mui/envinfo
  System:
    OS: Windows 10 10.0.22621
  Binaries:
    Node: 17.5.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.18 - C:\Program Files\nodejs\yarn.CMD
    npm: 8.19.2 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Chrome: Not Found
    Edge: Spartan (44.22621.963.0), Chromium (108.0.1462.54)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the desktop behavior in the linked CodeSandbox using the SwipeableDrawer and compare it with touch-device behavior. Trace the SwipeableDrawer entry point and existing interaction tests, if present, to determine how dragging is handled. Done means dragging the drawer on desktop dismisses it while existing touch behavior remains intact.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.