[transitions] "Cannot read property `scrollTop` of null"
See original GitHub issue- The issue is present in the latest release.
- I have searched the issues of this repository and believe that this is not a duplicate.
Current Behavior 😯
If the child of <Transition> components does not forwardRef to DOM, it cause this error.

Expected Behavior 🤔
The error should be more informative about how to fix it.
Steps to Reproduce 🕹
Steps:
- open this sandbox https://codesandbox.io/s/transition-v5-error-dide8?file=/src/App.tsx
- change material-ui/core to v5.beta
- will see the error
Context 🔦
Is it better to display warning (in console) instead of Error?
Here is what I think about the dev experience.
- write the code (use Transition the wrong way, no forwardRef for child)
- check in browser, it does not work (the ui display without transitioning)
then, 3 possibilities
- they see the warning in console about why it does not work and link to full doc example
- they go to Transition docs
- worse case, they open the issue
Actions
Your Environment 🌎
`npx @material-ui/envinfo`
Don't forget to mention which browser you used.
Output from `npx @material-ui/envinfo` goes here.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:12
- Comments:13 (3 by maintainers)
Top Results From Across the Web
Testing Material Ui (v5) Drawer - Cannot read property ...
Workaround - Apply the following props on Drawer or any Modal based component (eg. Dialog ) to disable Transitions whilst running tests. const ......
Read more >Cannot read property 'scrollTop' of null - Bountysource
There seems to be some issue while using the dropzone in function components. Most probably with the snackbar thingy as the file seems...
Read more >Troubleshooting - Material UI - MUI
Cannot read property scrollTop of null. This error comes from Fade , Grow , Slide , Zoom components due to a missing DOM...
Read more >When editing a user picker custom field, a 'Cannot read ...
Exception: Uncaught TypeError: Cannot read property 'scrollTop' of undefined. Steps to reproduce. Create a customfield with User Picker (multiple users) ...
Read more >HTML DOM Element scrollTop Property - W3Schools
The number of pixels the element's content is scrolled vertically. If the number is negative, the number is set to 0. If the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Also facing the same problem… so are you saying that if the child is a
styled-component
and does not have aforwardRef
it would not work…? Shouldn’t theFade
(or all transitions) work with or without aref
?We have many components that are just plain
styled-components
without a ref (because there were simply no need to use a ref) but now we have to add it everywhere just to get transition to work??Perhaps all transitions should wraps the child with a plain div instead?
The workaround I had to do, was to manually wrap the
children
with anotherdiv
… 👎Thanks - this saved me some debugging. I had this construct:
Fixed by adding the actual components as the only child, e.g.,