-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Document View Transition events fields #7961
Comments
Seems like a job for @martrapp to weigh in on? Martin, can you provide clarity/guidance here for whatever might be missing from docs perspective, and confirm that we have an exhaustive list here? Then, would be happy to receive a PR to docs to document these properties! |
Hi @sarah11918, thank you for pinging! As @Fryuni said, it would be good to have the event's properties and there purpose defined in the docs. Especially because they are already partly used in the examples. As discussed on discord, it might make sense to have the description in the reference section. As nobody knows the view transition events better than @Fryuni, I can of course confirm that the list was exhaustive when the issue was opened. A new signal property was just added last week.
What I also can add, as it may be less obvious:
I would be happy to help with a PR, but I won't open one myself on this topic, as there are certainly better technical writers than me ;-) |
Me as well! I'm happy to help, but there are better writers. |
Well, I can try writing something and then an actual good writer can make it readable 😆 |
Go for it!! I have faith in you! (And, I have a red pen if that faith is misplaced...) |
ASIDE: @martrapp I see that this PR was released but with no changeset or docs, so I never saw it before merging. Is this also something we need to factor in to new view transitions docs? withastro/astro#10908 |
Once we make that "official" it would fit well to the description of the |
Sorry Sarah 🫣 This is on my queue, it just has been moving slowly. I've started catching up on all my pending OSS work yesterday. So it will come! But I'm not stopping anyone from writing this before me |
see #9084 |
Thanks for starting this thread! We wanted to explain the It sounds like we're exploring an API reference in this PR already. I think we should include |
📚 Subject area/topic
View Transitions
📋 Suggested page
Either on the View Transitions page (https://docs.astro.build/en/guides/view-transitions/#lifecycle-events) or on some reference page
📋 General description or bullet points (if proposing new content)
Document the type of the View Transition events, which fields are available and what each of them represent.
astro:page-load
,astro:after-preparation
andastro:after-swap
have no special field and are the most used events, this may lead users to incorrectly assume that none of the events have special properties.Both
astro:before-preparation
andastro:before-swap
have the following properties:from: URL
: The URL of the page initiating the transition.to: URL
: The URL transitioning to. (can be modified)direction: Direction | string
: Direction of the transition, used to change to a different animation when going back in history.navigationType: NavigationTypeString
: What kind of history navigation is being appliedpush
: New URL is added to the historyreplace
: New URL replaces the previous URL in the historytraverse
: History remains unchanged, transition is moving through the historysourceElement: Element | undefined
: Element that triggered the navigation, if it came from a DOM element. This is undefined when the navigations was initiated from thenavigate
API.info: any
: ?? Unclear to me where this comes from, requires some investigation.newDocument: Document
: Content that will be swapped in place of the current document (document.documentElement
).astro:before-preparation
also has:formData: FormData | undefined
: The data that will be sent on the request to load the next page if a form action triggered the navigation.loader: () => Promise<void>
: The function that runs the next phase of the transition (loading the next page). Can be overridden to add extra behavior or to prevent the execution of the next phase.astro:before-swap
also has:viewTransition: ViewTransition
: The View Transition element that allows you to hook into it's promises. On browsers that don't have native VT this will be an object implementing the same API.swap: () => void
: The function that runs the next phase of the transition (swapping the new document in place of the old document). Can be overridden to add extra behavior or to prevent the execution of the next phase.The text was updated successfully, but these errors were encountered: