Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

disable scroll to top on navigating with data-turbo-scroll="false" #496

Closed
eladmarg opened this issue Dec 10, 2021 · 4 comments
Closed

disable scroll to top on navigating with data-turbo-scroll="false" #496

eladmarg opened this issue Dec 10, 2021 · 4 comments

Comments

@eladmarg
Copy link

this is not a must, but every link trigger the page to top (as normal web behavior - this is expected, so far so good).

however, there are some cases we wouldn't want to scroll top, for instance, when you're filtering multi facets,
the url is changing, new data has arrived and now you have to scroll down again to the previous position

this is really easy to add this, (did this on my repo) , if this is acceptable, i will submit a pr.
thanks

@markahesketh
Copy link

Would you be able to share your repo? I'm also looking for a solution to this.

In my case, I have a list of basket lines - and when removing one the page scrolls back to the top losing your position.

It works if the basket is put inside a turbo frame - however then other areas of the UI do not update, such as the basket count in the header.

@mtomov
Copy link

mtomov commented Mar 5, 2022

I'd also second the need for this, even if it's just a guide on how to achieve it.

@eladmarg do you mind sharing your solution?

@janbaykara
Copy link

My usecase is that I'm using a link to toggle an option on a page, which updates a URL parameter, and I want the page scroll position to stay the same.

@nxmndr
Copy link

nxmndr commented Jul 15, 2022

#37 duplicate

Use case : sometimes you have to perform actions down a page using a basic form without JS, and you don't want to scroll after every action to see the result.

edit Finally made it work using <turbo-frame id="root-path-to-post-action">

@dhh dhh closed this as not planned Won't fix, can't repro, duplicate, stale Jul 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

6 participants