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

Not working after the page transition in Astro #203

Closed
Nomango opened this issue Oct 30, 2023 · 5 comments · Fixed by #204 or #206
Closed

Not working after the page transition in Astro #203

Nomango opened this issue Oct 30, 2023 · 5 comments · Fixed by #204 or #206

Comments

@Nomango
Copy link
Contributor

Nomango commented Oct 30, 2023

Bug description

medium-zoom is not working after the page transition in Astro.

The reason seems to be that style in header is gone after page transition.

How to reproduce

  1. Use Astro and ViewTransition
  2. Execute mediumZoom and navigate to any page
  3. See error

Expected behavior

mediumZoom works normally.

Reproducible example

Link to the bug reproduction

Environment

  • medium-zoom version: 1.0.8
@francoischalifour
Copy link
Owner

This isn't a problem with Medium Zoom but rather with the Astro page transition lifecycle?

@Nomango
Copy link
Contributor Author

Nomango commented Oct 30, 2023

Astro documentation mentions that

The contents of the <head> are swapped out inside the startViewTransition callback

and also

Module scripts are only ever executed once because the browser keeps track of which modules are already loaded. For these scripts, you do not need to worry about re-execution.

So that the injected css disappears after cleaning <head> during page transition.

Should it be automatically re-injected?

@francoischalifour
Copy link
Owner

francoischalifour commented Oct 30, 2023

I see. Ideally we would expose another JS bundle without injected styles, and another CSS dist file that you would import yourself. This way you've got better control on the styles.

@francoischalifour
Copy link
Owner

Would you be interested in contributing to this?

@Nomango
Copy link
Contributor Author

Nomango commented Oct 30, 2023

Of course! But... my front-end skills are not good. Actually, I can only understand what you mean but have no idea about how to implement it. 😂 Sorry.

If you don't have much time on it, I am willing to give it a try, but it may take some time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants