Skip to content

Why can't turbo-frame responses use morphing? #1357

Open
@olly-chadwick-carwow

Description

I think I'm right in saying that turbo doesn't allow users to handle Turbo Frames using morphing/idiomorph. If this is the case, I'm wondering why this is. Are the reasons:

  • technical (it would be hard/impossible to do)?
  • principled (this is not the way the library should be used)?
  • or is it simply that this is a low priority/niche feature which no-one has requested yet?

If the latter, then perhaps I can explain my own use case.

Use case

On a product listing page, I have a "turbo frame" filters panel. When a user selects one of the filters, the page is updated and the panel updated. When the page is viewed on mobile, the filters panel covers the entire page, and the scroll state of the panel element is important.

Currently when a filter is selected and the filters panel turbo frame is re-rendered, the entire content of the panel is replaced and the scroll state is lost (focus jumps back up to the top of the page). If I could use morphing when rendering the turbo frame, then only the elements of the filters panel that had changed would be re-rendered on the page, and the scroll state of this element would be preserved.

There are certainly other ways of achieving the same thing. For example, I am currently implementing the filters panel using turbo-streams (which do allow for morphing), and I would also like to try redoing the page using turbo-drive (which also allow for morphing).

However, I am curious as to why morphing is restricted when it comes to turbo frame responses.

Many thanks!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions