Skip to content

[Turbo] InstantClick should not prefetch links from Web Debug Toolbar #1520

@davidgorges

Description

@davidgorges

Turbo 8 comes with InstantClick by default. This prefetches links while the cursor is hovering, which is a nice feature.

The WebDebugToolbar intercepts Ajax calls, which include the prefetched requests via InstantClick and dynamically adds an entry to the Ajax menu. The makes it really hard to click on an entry.

Turbo8-Profiler.mp4

I think it would nice be to disable the prefetching for the WebDebugToolbar via data-turbo-prefetch="false" directly in the Profiler Bundle, but since it's Turbo specific I am not sure if that's the right place.

Another way would be to add an event listener to the turbo:before-prefetch event that checks if the prefetch event comes from the WebDebugToolbar, e.g.

    document.addEventListener("turbo:before-prefetch", (event) => {
        if (event.target.closest('.sf-toolbar') !== null) {
            event.preventDefault()
        }
    })

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy