Tweak Turbo to Provide a Slightly Better Experience
Explore how to enhance your Rails app by adjusting Turbo's progress bar delay from the default 500ms to a shorter duration to improve responsiveness. Understand Turbo's interaction with Ajax and JavaScript events, and learn best practices for managing JavaScript within your app to create a more predictable and stable user experience.
We'll cover the following...
Turbo’s impact on view management
In order to effectively manage the behavior of our views and any JavaScript that is needed, we need a solid baseline of behavior on which to build. Rails provides this, with one tiny exception: Turbo’s default setting for showing a progress bar.
Turbo (formerly called Turbolinks) hijacks all clicks and form submissions and replaces them with Ajax calls. It then replaces the <body> of the page with whatever the <body> is of the returned result. This is ostensibly to make every page faster, but ...