question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

event.preventDefault in react-router-dom is not working in Chrome and Firefox

See original GitHub issue

found this issue recently, the a tag generated by Link component will sometime refresh the whole page when the link is clicked, and it’s not 100% happened, sometimes it works as expected, but sometimes it refreshes the whole page

I think this issue most likely is related to browser, but just want to know anyone facing the same issue, and if so, is there anyway to solve it?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
StringEpsiloncommented, May 11, 2019

@kambing86 This should be fixed via #6711 in the next release.

0reactions
kambing86commented, May 11, 2019

@timdorr not sure should react-router catchs the error, but I don’t think is a common issue, just FYI

Read more comments on GitHub >

github_iconTop Results From Across the Web

event.preventDefault in react-router-dom is not working in ...
found this issue recently, the a tag generated by Link component will sometime refresh the whole page when the link is clicked, and...
Read more >
preventDefault won't work on Firefox - Stack Overflow
Your problem seems to be syntax errors and misnamed parameters. ... This always works: Firefox needs the "event handler", Chrome doesn't.
Read more >
Window: beforeunload event - Web APIs | MDN
The HTML specification states that authors should use the Event.preventDefault() method instead of using Event.returnValue to prompt the user.
Read more >
How To Handle DOM and Window Events with React
By responding to events with event handlers, you can create dynamic ... To stop an event, call the preventDefault action on the event....
Read more >
Modern client-side routing: the Navigation API
Chrome, for example, activates its native loading indicator, and allows the user to interact with the stop button. (This doesn't currently happen when...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found