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

fix: reinsert attribute to specify direction of ViewTransition #8109

Merged
merged 1 commit into from
Aug 17, 2023
Merged

fix: reinsert attribute to specify direction of ViewTransition #8109

merged 1 commit into from
Aug 17, 2023

Conversation

martrapp
Copy link
Member

Changes

astroTransition = dir is now set for the current document.
The removal of the attribute from the DOM is put on hold for now, since the removal seems to prevent fallback animations.
Plus: fix for an of-by-one bug I introduced in a previous commit that prevented the correct detection of direction ;-)

Testing

Manual tests only

Docs

n/a bug fix

@changeset-bot
Copy link

changeset-bot bot commented Aug 17, 2023

🦋 Changeset detected

Latest commit: 6ae9187

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions bot added the pkg: astro Related to the core `astro` package (scope) label Aug 17, 2023
@ematipico ematipico requested a review from matthewp August 17, 2023 05:51
@@ -233,15 +232,17 @@ const { fallback = 'animate' } = Astro.props as Props;
location.href = href;
return;
}
document.documentElement.dataset.astroTransition = dir;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why here and not inside of updateDOM?

Copy link
Member Author

@martrapp martrapp Aug 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:)

  1. symmetry: removing the attribute is done a few lines further down in "Navigate". Same level.
  2. When I removed doc.documentElement.dataset.astroTransition = dir from updateDOM, it was clear that updating the DOM does semantically not depend on a direction. (this was the only usage of dir in this function)
    Thought the code only moved there, because of the dependency on the parsed doc-DOM (doc)
  3. simpler, less parameters for updateDOM

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, trust your judgment here, thanks!

@matthewp matthewp merged commit da6e3da into withastro:main Aug 17, 2023
@astrobot-houston astrobot-houston mentioned this pull request Aug 17, 2023
@martrapp martrapp deleted the reinsert_vt_direction branch August 17, 2023 13:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg: astro Related to the core `astro` package (scope)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants