The turbo handbook explains target: '_top'
here and here.
But I still don't understand what's the difference between these two forms:
#1
<%= turbo_frame_tag 'new_search', target: '_top' do %>
<%= search_form_for :q do |f| %>
...
<% end %>
<% end %>
#2
<%= search_form_for :q do |f| %>
...
<% end %>
Both form will send a normal HTML format request via GET method, and the whole page will be replaced by Turbo Drive. So their behavior looks quite similar in this case.
Is target: '_top'
only useful when I need to lazy load something via the src
attribute of Turbo Frame while I want the content navigate outside the frame? :
<%= turbo_frame_tag 'something', src: '/something', target: '_top' %>