Skip to content
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

e.preventDefault() does not prevent animation #50

Closed
imclint21 opened this issue Nov 1, 2023 · 3 comments
Closed

e.preventDefault() does not prevent animation #50

imclint21 opened this issue Nov 1, 2023 · 3 comments

Comments

@imclint21
Copy link

imclint21 commented Nov 1, 2023

Hi,

In a nested button inside a Link, if you call preventDefault, it does not prevent the animation.

<Link href={"/somewhere"}>
    <button onClick={(e) => e.preventDefault()}>Hey</button>
</Link>

Regards

@lucasoz
Copy link

lucasoz commented Nov 7, 2023

This is happening in my code

@tomcru
Copy link

tomcru commented Nov 10, 2023

#37 (comment) you can use e.nativeEvent.stopImmediatePropagation();

I've since created my own top loader: https://github.com/tomcru/holy-loader

@imclint21
Copy link
Author

I confirm that it works nice using both like this:

event.preventDefault();
event.nativeEvent.stopImmediatePropagation();

bootleq added a commit to bootleq/feeders that referenced this issue Dec 15, 2024
The preventDefault handling is broken since introduce TopLoader, causes
the TopLoader progress bar appears, without ending.

Solution is to stop propagation on native event
TheSGJ/nextjs-toploader#50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants