Skip to content

[2.0] Prefetch click triggers visit on secondary button mouseup #2185

@ChrisB-TL

Description

@ChrisB-TL

Version:

  • @inertiajs/vue3 version: 2.0.0

Describe the problem:

When using prefetch="click", the visit is triggered on mouse up of the secondary mouse button (e.g. user is attempting to access context menu) - making it impossible to e.g. open in new tab without triggering a visit in the current window.

I cannot think of a scenario where the intent behind a secondary button press would be a visit in the same window (i.e. will always be new tab, new window, etc.), so we could probably just ignore any MouseEvent where MouseEvent.button === 2 (or possibly where MouseEvent.button !== 0).

I have only tested w/ Vue3, but it looks like this behavior is common to all adapters.

Steps to reproduce:

<Link href="/" prefetch="click">I shouldn't be visited when clicked with secondary</Link>

Metadata

Metadata

Assignees

No one assigned

    Labels

    prefetchingRelated to the prefetching feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions