-
-
Notifications
You must be signed in to change notification settings - Fork 557
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
feat: view-transition-api #2211
base: main
Are you sure you want to change the base?
Conversation
Run & review this pull request in StackBlitz Codeflow. |
✅ Deploy Preview for elk-docs canceled.
|
✅ Deploy Preview for elk-zone ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
We have support for this built in to Nuxt, which can be enabled with: export default defineNuxtConfig({
experimental: {
viewTransition: true
}
}) Of course, it still needs to be used with CSS. |
@danielroe Wow, that is awesome! I will look into it. That should eliminate the 100ms hack I think 😄 |
This looks amazing @horvbalint! |
It would be nice if also adding the transition when clicking in the toot account. |
That would be great indeed 😍 I will work on this in the upcoming days, hopefully it will take shape slowly. |
Refactor + account animation
I refactored the code and now it also supports the 'open account' animation (even if the booster account is clicked!) |
I excluded the account-hover-card from the transition and that apparently solved the occasional animation error 🎉 |
sorry for the long delay in reviewing 🙏 |
No problem😄 I converted it back into draft today, since I found some bugs + I want to add a user preference for the animation now that elk is using nuxt 3.10. |
cannot see any transition on PR preview on my local... |
@horvbalint can you run lint script on your local? it seems you need to fix the dts |
can you update your main branch and merge changes in view-transition-api branch? |
They are off by default, you can enable them in sttings/preferences/experimental. + the transition is quite choppy in dev mode, but smooth in production builds. |
nice, the account transition also included (awesome) |
I still have some plans to fix/improve things, like the transition to a status page where there are many replies have a big stutter currently when the replies are rendered. |
forgot the ci error, will take 6 hours to finish, some vitest worker cannot be terminated, there is a pending PR to fix it |
@horvbalint PR merged, you can check now your Nuxt PR here |
Thanks @userquin 🎉 I will work on this in the upcoming days. |
…+ context loading fix
Waiting for the transition to end before rendering the context resulted in a pretty big improvement 🥳 Screenrecorder-2024-03-17-20-00-51-675.mp4After: Screenrecorder-2024-03-17-20-01-45-909.mp4I also fixed the context loading skeletons, those were shifted out of the view by a big margin from the status. |
Beautiful 😍 |
Maybe we should indicate it in 'Preferences' if the ViewTransition API is not supported by the browser? (It is only available in chromium now) |
…orted by the browser
I am not sure how to signal not available functionality the proper way. In the last commit I made the settings row disabled when ViewTransitions are not supported by the browser, is this enough? Won't it be confusing why it does nothing? Or maybe the row should be hidden altogether? Should we put an explainatory text somewhere? |
I think disabling the row looks good. In addition to that, how about adding a help message to the disabled row, for example, "This browser currently does not support View Transition API"? So that users can understand why this setting is not available on their browsers. |
@@ -552,6 +552,8 @@ | |||
"use_star_favorite_icon": "Use star favorite icon", | |||
"user_picker": "User Picker", | |||
"user_picker_description": "Displays all avatars of logged accounts in the bottom-left so you can switch quickly between them.", | |||
"view_transitions": "View Transitions", | |||
"view_transitions_description": "Navigate pages while transitioning the common elements between them.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be more user oriented, it's very technical, something like 😍 Enable beutiful animations when navigating between pages
(the emoji shouldn't be included) would be better
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/cc @patak-dev any suggestion here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think maybe we should just say:
"view_transitions_description": "Navigate pages while transitioning the common elements between them.", | |
"view_transitions_description": "Animate transitions.", |
This happens, because the context of a status has to be fetched when opened, while the status itself is reused from the timeline. So they appear later and shift the layout. I am not really sure what to do about this, but will try to figure something out. |
In this PR I created a demo for the (very) new View Transitions API.
This API allows web applications to animate complex layout shifts with relative ease and achieve a very native like look. This PR is only a rough demo of the feature, it can be improved a lot if this is something that the core Elk maintaners and the community would like to see.
The API is currently only available in desktop and android Chrome, for other browsers everything should work like before.
How does it look?
Currently only the change between the feed and a specific post is animated.
mobile.demo.mp4
Hacks/Changes/Problems:
These hacks and problems can be eliminated with some more work (in theory).
When opening a reply, the animation succeeds, but after the context loads, it jumps to its place and looks bad :/
I don't think this is in the scope of this PR though.
Other plans:
More information on this API can be found here: https://developer.chrome.com/docs/web-platform/view-transitions/