nextjs-toploader
nextjs-toploader copied to clipboard
Don't trigger start animation when clicking on an button within anchor
Considering this case
<a href="/username">
<button
onClick={(e) => {
e.stopPropagation();
follow();
}}>
Follow
</button>
</a>
Issue: When the button is clicked, the progress bar triggered Expected: When the button is clicked, the progress bar should not do anything. There should be a way to prevent the progress bar to not being triggered
I am in the same boat (as mentioned here: https://github.com/TheSGJ/nextjs-toploader/issues/8)
@krehwell did you find any solution for your problem?
@baba43 ends up using this package instead: https://github.com/Skyleen77/next-nprogress-bar
works flawlessly for us
Should also work in https://github.com/TheSGJ/nextjs-toploader/issues/61#issuecomment-1853335459
I had similar case and this seems to fix the issue
e.nativeEvent.stopImmediatePropagation();
so instead of e.stopPropagation() try calling it.
I had similar case and this seems to fix the issue
e.nativeEvent.stopImmediatePropagation();
so instead of e.stopPropagation() try calling it.
Worked for me! 💯