A more efficient way to disable instant click with JavaScript?

A trick I have used for other attributes (not this one particularly) is to add that attribute during the connect() method. Maybe try something like this in your clipboard controller (or any other that may be similarly impacted):

import { Controller } from "@hotwired/stimulus"

export default class extends Controller {

  connect() {
    this.element.setAttribute('data-turbo-prefetch', false);
  }
  ...etc

See if that helps in your case (I haven’t tried it yet).

Walter

1 Like