Any advice on debugging why Turbo is not handling a particular form?
I am using Turbo Rails and drive mode is working flawlessly for normal navigation, but a particular form that I’m trying to use with stream does not seem to be handled by Turbo. The browser is submitting the form as normal. Form looks like:
<%= turbo_frame_tag "#{dom_id(chat)}_chat_message_form" do %>
<%= form_with(model: ChatMessage.new, url: chat_chat_messages_path(format: :turbo_stream)) do |form| %>
<div class="my-5">
<%= form.text_area :message, rows: 4, class: "block shadow rounded-md border border-gray-200 outline-none px-3 py-2 mt-2 w-full", autofocus: true, "x-on:keydown.cmd.enter" => "$event.target.form.requestSubmit();" %>
</div>
<div class="grid justify-items-end">
<%= form.button type: :submit, class: "rounded-lg py-3 px-5 bg-blue-600 text-white inline-block font-medium cursor-pointer" do %>
<i class="fas fa-paper-plane"></i>
<span class="pl-2">Send</span>
<% end %>
</div>
<% end %>
<% end %>
The x-on:keydown.cmd.enter
is also not working. Stimulus and Turbo are working elsewhere so I am really stumped by this.
Same issue as here, but I think I narrowed it down to Turbo not preventing default on the form: Turbo Not Accepting Turbo Stream - rubyonrails-talk - Ruby on Rails Discussions