79390495

Date: 2025-01-27 11:08:14
Score: 0.5
Natty:
Report link

Using Turbo 8 via turbo-rails 2.0.11: autofocus did not work for me. It always moves the cursor to the start of the line in Firefox. Also, only one input field can have autofocus, but maybe I should have tried adding an ID for this.

The turbo_permanent attribute works great. I am using #search to automatically submit after a certain timeout, triggering Turbo.visit(url, { action: "replace" }) to also update the GET params in the URL, no POST request needed.

  <%= form.text_field :test_name,
                   placeholder: "Filter by test name...",
                   value: params[:test_name] || session[:test_name],                          
                   data: {
                     turbo_permanent: true,
                     action: "input->search-form#search keypress->search-form#submitOnEnter"
                   } %>
Reasons:
  • Blacklisted phrase (1): did not work
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: Kjell