React onClick
handler with preventDefault()
on an anchor tag does not prevent navigation
#1464
Labels
bug
Something isn't working
Describe the bug
An
<a href="https://example.com">Click me</a>
tag with a click handler that invokesevent.preventDefault()
should prevent the subsequent navigation.When doing this with pure DOM APIs:
This passes.
When doing the same, but passing through React (and its synthetic event handling):
This fails, but should pass.
To Reproduce
https://stackblitz.com/edit/stackblitz-starters-x99sjj?file=package.json
The "Pure DOM"-based test passes
The React-based one fails
Expected behavior
The React test should pass
Additional context
In real DOM and in JSDom this works as expected
The text was updated successfully, but these errors were encountered: