The event we were passing to shouldIntercept from the React adapter was the React synthetic event, which does not have all the properties of the underlying native event. It seems wise to keep the intercept helper function framework-agnostic, so this change now passes the event.nativeEvent to shouldIntercept.
The event.which property is deprecated. The purpose it previously served for evaluating MouseEvent eligibility is now covered by the newly-introduced event.button check.
I realized TypeScript didn't have my back here to catch the type mismatch mismatch, so I added a type signature to the visit function and expanded the onClick prop signature (since this is a polymorphic element, this may not always be an HTMLAnchorElement).
Thanks to some crafty sleuthing by @shengslogar (https://github.com/inertiajs/inertia/pull/1908#issuecomment-2190390026), there are a few things to clean up after #1908:
shouldIntercept
from the React adapter was the React synthetic event, which does not have all the properties of the underlying native event. It seems wise to keep the intercept helper function framework-agnostic, so this change now passes theevent.nativeEvent
toshouldIntercept
.event.which
property is deprecated. The purpose it previously served for evaluatingMouseEvent
eligibility is now covered by the newly-introducedevent.button
check.visit
function and expanded theonClick
prop signature (since this is a polymorphic element, this may not always be anHTMLAnchorElement
).