diff --git a/modules/refreshless_turbo/js/progress_bar.js b/modules/refreshless_turbo/js/progress_bar.js index deed8be302fc45f3ceb672aa748b5c17931c6f27..cc64e3e2dacfd5a50691d859c11c4137df0b45bf 100644 --- a/modules/refreshless_turbo/js/progress_bar.js +++ b/modules/refreshless_turbo/js/progress_bar.js @@ -50,13 +50,19 @@ progressBarDelay.hideVisit(); html.removeEventListener( - 'turbo:load', hideSuccess, {once: true}, + 'refreshless:before-render', hideSuccess, {once: true}, ) }; + // We're using refreshless:before-render rather than turbo:load because the + // progress bar is noticeably less smoothly transitioned out when loading + // some complex/heavy pages on mobile in some browsers, specifically Firefox + // on Android. The refreshless:before-render is early enough that it should + // give the progress bar enough time to transition out before the new <body> + // contents are rendered. html.addEventListener( - 'turbo:load', hideSuccess, {once: true}, + 'refreshless:before-render', hideSuccess, {once: true}, ); html.addEventListener(