[BottomNavigation] onClick does not fire if tapped while scrolling
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 99.1k
- Forks
- 32.5k
- Avg merge
- 2d 17h
- Merged PRs (30d)
- 106
Description
When i try to tap (touch click) on a BottomNavigationAction while the page is currently scrolling, the onClick event handler is never called. The TouchRipple effect however runs flawlessly, which makes me believe that this is an issue with how touch events are handled in ButtonBase. If i change my onClick for a onTouchStart it is called as expected, but of course this is not a viable solution, as it does not take swiping into account.
- 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 i press the BottomNavigationAction while the page is scrolling, the page stops scrolling and the TouchRipple effect runs. If i press again, now that the page has stopped scrolling, the onClick event handler is called.
Expected Behavior 🤔
When i press the BottomNavigationAction while the page is scrolling, the TouchRipple effect runs and my onClick handler is called.
Steps to Reproduce 🕹
Steps:
- Go to a page where you have a BottomNavigation, where you can scroll vertically
- Swipe up
- While the phone is scrolling, tap the BottomNavigationAction
Context 🔦
When you scroll on mobile, it takes a while for it to stop scrolling, if you do it fast enough. Therefore i want it to be possible, to click the BottomNavigationAction while the phone is scrolling.
Your Environment 🌎
I experience the issue when running mobile emulation in Chrome Devtools. A tester is also experiencing this issue on an iPhone 11 Pro on Safari.
| Tech | Version |
|---|---|
| Material-UI | v4.9.1 |
| React | v16.12.x |
| Browser | Chrome |
| TypeScript | v3.9.3 |
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the issue with BottomNavigationAction while the page is still scrolling, then trace its event handling through ButtonBase and the TouchRipple behavior. Compare the scrolling and stationary cases and add or update coverage for the touch interaction. Done means tapping during momentum scrolling invokes onClick while preserving swipe behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100