hotwired / turbo

The speed of a single-page web application without having to write any JavaScript
https://turbo.hotwired.dev
MIT License
6.72k stars 428 forks source link

Turbo morph displays progress bar #1211

Open rbclark opened 7 months ago

rbclark commented 7 months ago

First of all, the new morphing feature feels extremely seamless whenever a refresh is triggered. If it weren't for the progress bar, I'm not even sure I'd know that it was happening. As an end user of an app that utilizes morphing it is likely not necessary and is instead potentially distracting to see a refresh bar appear when they aren't even expecting the page to refresh. Is there any way to disable the progress bar for page morph actions?

omarluq commented 7 months ago

@jorgemanrubia thoughts on this proposal? I think it would be beneficial to allow users to disable the progress bar both globally and at the frame/stream level. This would provide greater flexibility in managing user experience. Example:

// Turns off the progress bar globally
Turbo.progressBar = 'off';
<turbo-stream action="refresh" target="example_target" progress-bar="off">
  <template>
    <!-- Content updates here won't trigger the progress bar -->
  </template>
</turbo-stream>

<turbo-frame id="example_frame" progress-bar="off">
  <!-- Content here won't trigger the progress bar when loading -->
</turbo-frame>
omarluq commented 7 months ago

across the board control can also be achieved with an attribute on the turbo-refresh-method meta tag instead of JS config e.g.

<meta name="turbo-refresh-method" content="morph"  progress-bar="off">

or a new meta tag for the progress bar only e.g.

<meta name="turbo-progress-bar" content="off">