Removed out directive for viewtransition function #302
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi, I'd like to propose that the
out
directive be removed for the viewtransition function for transitions on navigation.Currently, when navigating between routes and when using the
fade
transition from "svelte/transition", both the old and new incoming route components immediately become visible and are relatively, vertically "stacked." One routes' components are above and the other's below, potentially increasing the page height. Then both fade out concurrently for the duration set, with the 'fade in' seemingly having no effect.Alternatively, if removing of the
out
directive is not ideal and there are use cases for other transitions where both thein
andout
directives are necessary, another approach could be to pass an additional key/value in the viewtransition prop object like:viewtransition="{() => ({ fn: fade, duration: 500, inOnly: true })}"
Where in this case we could delineate either
inOnly: true
,outOnly: true
or simply omit the field to maintain the current implementation.Taking this approach, the new
viewtransitionFn
could look something like:In this approach, when choosing to use only the
in
orout
directive, the duration of the opposite directive is set to 0, essentially removing its effect.Would love to know what you think! Happy to make another a PR for the latter approach if necessary. Thank you!