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

Describe criteria for link and form morphing #178

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Commits on Feb 29, 2024

  1. Describe criteria for link and form morphing

    Expand upon the Page Refresh sections explaining how to morph and
    preserve scrolling.
    
    Page Refreshes
    ---
    
    A "page refresh" is a [application visit](/handbook/drive#application-visits) with a `"replace"` action to a URL with a whose [pathname](https://developer.mozilla.org/en-US/docs/Web/API/URL/pathname) matches the current URL [path](https://developer.mozilla.org/en-US/docs/Learn/Common_questions/Web_mechanics/What_is_a_URL#path_to_resource). Page refreshes can be initiated by driving the page with a link, or by [redirecting after a form submission](/handbook/drive#redirecting-after-a-form-submission). In either case, the elements must have a `[data-turbo-action="replace"]` attribute:
    
    ```html
    <a href="/" data-turbo-action="replace">Page refresh link</a>
    
    <form action="/redirect_back" method="post" data-turbo-action="replace">
      <button>Page refresh form</button>
    </form>
    ```
    seanpdoyle committed Feb 29, 2024
    Configuration menu
    Copy the full SHA
    61f6c52 View commit details
    Browse the repository at this point in the history