I'm creating a ScrollToTop component by using MUI useScrollTrigger hook https://mui.com/material-ui/react-app-bar/#usescrolltrigger-options-trigger
Here is the sample code: https://codesandbox.io/s/stackoverlow-mui-usescrolltrigger-er9z4y
Problems
- The
ScrollTopcomponent doesn't appear after scrolling some pixels even after scrolling to the bottom of the page.
Here is the screenshot.
The ScrollToTop component should appear around the area I marked.
As we could see that the trigger value from the useScrollTrigger hook returns a false value. It should return a true value if we scrolled the page.

- If we uncomment the
ScrollToTopcomponent, theScrollToTopcomponent would appear. Then if we click theScrollToTopcomponent, the screen would not go to the top of the page.
Step To Reproduce
For problem 1:
- Open the demo (codesandbox link) above.
- Scroll to the bottom of the page.
For problem 2:
- Open the demo (codesandbox link) above.
- Comment only the
ScrollToTopcomponent. - Scroll to the bottom of the page.
- Click the
ScrollToTopcomponent.
Expected conditions
- For problem 1: the
ScrollTopcomponent appears after scrolling some pixels. - For problem 2: the
ScrollTopcomponent should bring the screen to the top of the page after being clicked.
