Steps to reproduce
Steps:
- Open this live example: https://stackblitz.com/edit/ob1sd6fc-ta22ng51?file=src%2FDemo.tsx
- Open the preview in a touch-enabled device or enable touch emulation in DevTools
- Click either "Open Test 1" or "Open Test 2" button to open either drawer
- Attempt to close the drawer by swiping (touch drag gesture)
Current behavior
The application crashes with the following error:
Uncaught TypeError: Cannot read properties of undefined (reading 'contains')
Expected behavior
The drawer closes
Context
From testing, this happens because mergeSlotProps does not correctly handle the callback ref returned by useForkRef, and will overwrite it with the external ref if present.
Your environment
npx @mui/envinfo
System:
OS: Windows 11 10.0.26100
Binaries:
Node: 20.19.5 - C:\nvm4w\nodejs\node.EXE
npm: 10.8.2 - C:\nvm4w\nodejs\npm.CMD
pnpm: Not Found
Browsers:
Chrome: 135.0.7049.42
npmPackages:
@emotion/react: ^11.14.0 => 11.14.0
@emotion/styled: ^11.14.1 => 11.14.1
@mui/core-downloads-tracker: 7.3.9
@mui/lab: 7.0.1-beta.22 => 7.0.1-beta.22
@mui/material: ^7.3.9 => 7.3.9
@mui/private-theming: 7.3.9
@mui/styled-engine: 7.3.9
@mui/system: 7.3.9
@mui/types: 7.4.12
@mui/utils: 7.3.9
@mui/x-date-pickers: ^7.29.4 => 7.29.4
@mui/x-internals: 7.29.0
@types/react: ^19.2.14 => 19.2.14
react: ^19.2.4 => 19.2.4
react-dom: ^19.2.4 => 19.2.4
typescript: ^5.9.3 => 5.9.3
Search keywords: mergeSlotProps SwipeableDrawer paper ref
Steps to reproduce
Steps:
Current behavior
The application crashes with the following error:
Uncaught TypeError: Cannot read properties of undefined (reading 'contains')Expected behavior
The drawer closes
Context
From testing, this happens because mergeSlotProps does not correctly handle the callback ref returned by useForkRef, and will overwrite it with the external ref if present.
Your environment
npx @mui/envinfoSearch keywords: mergeSlotProps SwipeableDrawer paper ref