nextjs-toploader icon indicating copy to clipboard operation
nextjs-toploader copied to clipboard

Don't trigger start animation when clicking on an button within anchor

Open krehwell opened this issue 1 year ago • 5 comments

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

krehwell avatar Jul 26 '23 05:07 krehwell

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 avatar Aug 30 '23 12:08 baba43

@baba43 ends up using this package instead: https://github.com/Skyleen77/next-nprogress-bar

works flawlessly for us

krehwell avatar Aug 30 '23 16:08 krehwell

Should also work in https://github.com/TheSGJ/nextjs-toploader/issues/61#issuecomment-1853335459

donovanglover avatar Dec 31 '23 15:12 donovanglover

I had similar case and this seems to fix the issue

e.nativeEvent.stopImmediatePropagation(); so instead of e.stopPropagation() try calling it.

GiorgiTsukhishvili avatar Apr 24 '24 14:04 GiorgiTsukhishvili

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! 💯

mabbasbangash97 avatar Jul 26 '24 11:07 mabbasbangash97