# Data-turbo="true" not enabling Turbo

**URL:** https://discuss.hotwired.dev/t/data-turbo-true-not-enabling-turbo/4250
**Category:** General
**Created:** [June 22, 2022, 11:48am UTC](https://discuss.hotwired.dev/t/data-turbo-true-not-enabling-turbo/4250 "2022-06-22T11:48:38Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![braindeaf](https://yyz1.discourse-cdn.com/flex027/user_avatar/discuss.hotwired.dev/braindeaf/32/2786_2.png) [@braindeaf](https://discuss.hotwired.dev/u/braindeaf)
#### Post date: [June 22, 2022, 11:48am UTC](https://discuss.hotwired.dev/t/data-turbo-true-not-enabling-turbo/4250/1 "2022-06-22T11:48:38Z")

</div>

Hi there,

Just wanted to pose a question, I’m relatively new to Turbo and for the most part it seems to be straight forward. We’ve got a Rails 6 application (which we can’t upgrade to 7 right now). We have UJS and we are gradually working towards changing some legacy code to use Turbo/Hotwire.

We have disabled application wide Turbo and aim to add it in on a per-link basis until we are ready.

```auto
import '@hotwired/turbo-rails'
Turbo.session.drive = false // disable turbo app wide and add for specific elements gradually

```

However, the following does not trigger at all. I’m expecting it not to work unless I have _data-turbo=“true”_ of course.

```auto
<a href="/jobs/1" data-turbo="true" data-turbo-method="delete" data-turbo-confirm="Sure?>DELETE</a>

```

If I change _Turbo.session.drive = true_ it works fine, so for some reason this trigger is misbehaving. Any thoughts on why that might be the case?

Many many thanks

RobL

---

<div class="post-metadata">

### Author: ![tleish](https://yyz1.discourse-cdn.com/flex027/user_avatar/discuss.hotwired.dev/tleish/32/920_2.png) [@tleish](https://discuss.hotwired.dev/u/tleish)
#### Post date: [June 22, 2022, 3:39pm UTC](https://discuss.hotwired.dev/t/data-turbo-true-not-enabling-turbo/4250/2 "2022-06-22T15:39:39Z")

</div>

Bug. You might want to go make a comment or vote on a suggested PR:

> <https://github.com/hotwired/turbo/pull/500>
>
> If a user has \`Turbo.session.drive\` set to \`false\`, then using \`data-turbo-metho…d\` on a link will not work, because the form injected by Turbo will not be handled by turbo because the form does not have a \`data-turbo="true"\` attribute.
> 
> This bug has existed for a while, but I didn't run into until #341 was merged. Usually I will enable turbo for a section of the DOM with a \`data-turbo="true"\` attribute on a nearby parent element. This worked fine because the form that was created was injected adjacent to the link and so they shared a common parent with the \`data-turbo="true"\` attribute. But since #341, the form now gets injected at the bottom of the body so that links with a data-turbo-method will still work even if they are inside a \`\<form\>\` element. But they now no longer share a common ancestor chain and so won't have the same turbo enabled state.
> 
> This PR assumes that if turbo is handling the link, then it should also handle the form, which I think is a reasonable assumption. As a user of Turbo, I don't really want to think about or need to be aware of the fact that a form has been created and is the thing submitting the request.

---

<div class="post-metadata">

### Author: ![braindeaf](https://yyz1.discourse-cdn.com/flex027/user_avatar/discuss.hotwired.dev/braindeaf/32/2786_2.png) [@braindeaf](https://discuss.hotwired.dev/u/braindeaf)
#### Post date: [June 22, 2022, 3:46pm UTC](https://discuss.hotwired.dev/t/data-turbo-true-not-enabling-turbo/4250/3 "2022-06-22T15:46:12Z")

</div>

Good find there. I’ll do just that cheers 🙂
