#1255·turbo

Firefox issue with `scroll-behavior: smooth` and Turbo enabled (v8.0.4)

Author: colmexdevCreated May 5, 2024Updated Aug 11, 2026

Hi there.

Recently, I've been required to smooth scroll over the page depending on hash changing (applying scroll-behavior: smooth on the HTML tag and anchor tags clicking). While it seems to work fine in Chrome, there seems to be a bug in Firefox (can't test on other browser by now).

I created a repo with a minimal sample reproduction of this bug, where I tested with an alternative of using buttons to navigate. Downside here, as per the code used, is that URL is not updated.

On empty anchors (<a href="#">) and on visible elements (displayed on viewport at the time of click event, like #div1 after window load), smooth scrolling works just fine. Nonetheless, whenever the referred elements aren't on viewport, scrolling happens abruptly.

If it's strictly necessary to depend on data-turbo="false", I think I must do it, but it feels smelly to me considering that Chrome needn't this to work.

Thank you in advance for your attention!