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

autoscroll attribute not working #1358

Open
northeastprince opened this issue Jan 2, 2025 · 3 comments
Open

autoscroll attribute not working #1358

northeastprince opened this issue Jan 2, 2025 · 3 comments

Comments

@northeastprince
Copy link

<div>lorem ipsum</div>
<div>lorem ipsum</div>
<div>lorem ipsum</div>
<div>lorem ipsum</div>
<div>lorem ipsum</div>
<div>lorem ipsum</div>
<div>lorem ipsum</div>
<div>lorem ipsum</div>
<div>lorem ipsum</div>
<div>lorem ipsum</div>
<div>lorem ipsum</div>
<div>lorem ipsum</div>
<div>lorem ipsum</div>
<div>lorem ipsum</div>
<div>lorem ipsum</div>
<div>lorem ipsum</div>
<div>lorem ipsum</div>
<div>lorem ipsum</div>
<div>lorem ipsum</div>
<div>lorem ipsum</div>
<div>lorem ipsum</div>
<div>lorem ipsum</div>
<div>lorem ipsum</div>
<div>lorem ipsum</div>
<div>lorem ipsum</div>
<div>lorem ipsum</div>
<div>lorem ipsum</div>
<div>lorem ipsum</div>
<div>lorem ipsum</div>
<div>lorem ipsum</div>
<div>lorem ipsum</div>
<div>lorem ipsum</div>
<div>lorem ipsum</div>
<div>lorem ipsum</div>
<div>lorem ipsum</div>
<div>lorem ipsum</div>
<div>lorem ipsum</div>
<div>lorem ipsum</div>
<div>lorem ipsum</div>
<div>lorem ipsum</div>
<div>lorem ipsum</div>
<turbo-frame autoscroll="true">important</turbo-frame>
@4lllex
Copy link

4lllex commented Jan 2, 2025

autoscroll kicks in after you perform a turbo frame request

@northeastprince
Copy link
Author

That seems inconsistent with what the docs say, or at least ambiguous:

controls whether or not to scroll a element (and its descendant elements) into view when after loading

I imagine the main case where a frame would be replaced outside the viewport is when a Stream makes an insert or modification, but with morphing that's becoming increasingly obsolete.

From what I see, that leaves a few options:

  • Remove the feature
  • Update the docs, or:
  • Enable the attribute to work regardless of how it got there

@4lllex
Copy link

4lllex commented Jan 2, 2025

For turbo frame, autoscroll is usually used to scroll to the top of the frame, for example, if you have pagination implemented in a frame, when you click next page, the frame is updated and scrolls to the top of the results. I don't see how morphing would make this obsolete.

Docs can definitely be clearer about what "after loading" exactly means. It refers to loading the turbo frame, not just rendering it but actually performing a turbo frame navigation.

If you want to just scroll to an element, you could implement that behavior yourself:
https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView

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

2 participants