-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BottomNavigation] onClick does not fire if tapped while scrolling #22524
[BottomNavigation] onClick does not fire if tapped while scrolling #22524
Conversation
@material-ui/core: parsed: +0.15% , gzip: +0.21% |
@oliviertassinari I'm getting the |
I guess i could make a check, short circuiting the tests to completion if Touch is not defined. It's a little bit inelegant though. I don't think i know enough about your test setup to make an educated decision. |
It's what we do in https://github.com/mui-org/material-ui/blob/f37992f328fa3c2d5d08ad8296801e7ec1d29475/packages/material-ui/src/Slider/Slider.test.js#L28-L32 we could turn it into a skip(), could be cleaner. |
packages/material-ui/src/BottomNavigationAction/BottomNavigationAction.js
Outdated
Show resolved
Hide resolved
packages/material-ui/src/BottomNavigationAction/BottomNavigationAction.js
Outdated
Show resolved
Hide resolved
) { | ||
touchTimer.current = setTimeout(() => { | ||
target.dispatchEvent(new Event('click', { bubbles: true })); | ||
}, 10); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we could have something more reliable than an arbitrary 10ms delay.
packages/material-ui/src/BottomNavigationAction/BottomNavigationAction.test.js
Outdated
Show resolved
Hide resolved
…onAction.js Co-authored-by: Olivier Tassinari <olivier.tassinari@gmail.com>
…onAction.js Co-authored-by: Olivier Tassinari <olivier.tassinari@gmail.com>
Agreed. I tried using a skip, but i ran into this problem: mochajs/mocha#2819 |
Should be all good now @oliviertassinari :) |
@EliasJorgensen It's a great first pull request on Material-UI 👌🏻. Thank you for working on it! |
Closes #22368.
The
onTouchStart
andonTouchEnd
events are now also used to decide whether or not a given BottomNavigationAction is clicked.As per @oliviertassinari's request, a demo has been added showcasing how to fix BottomNavigation to the bottom of the page.