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

Element background flashes when using <ClientRouter /> #12720

Open
1 task done
wolf-yuan-6115 opened this issue Dec 11, 2024 · 3 comments
Open
1 task done

Element background flashes when using <ClientRouter /> #12720

wolf-yuan-6115 opened this issue Dec 11, 2024 · 3 comments
Labels
- P2: has workaround Bug, but has workaround (priority) feat: view transitions Related to the View Transitions feature (scope)

Comments

@wolf-yuan-6115
Copy link

wolf-yuan-6115 commented Dec 11, 2024

Astro Info

Astro                    v5.0.5
Node                     v22.3.0
System                   Windows (x64)
Package Manager          pnpm
Output                   static
Adapter                  none
Integrations             @astrojs/tailwind
                         @astrojs/sitemap
                         astro-icon
                         @astrojs/mdx
                         @playform/compress

If this issue only occurs in one browser, which browser is a problem?

Firefox

Describe the Bug

When using <ClientRouter /> (Previosly <ViewTransitions />) on Firefox with dark themed background, the element will be lighter when switching between pages.

2024-12-11.23-12-17.mp4

Seems like d7779df fixed flashing issue for website using light themed background when using <ClientRouter /> on Firefox. But on dark themed background website, it doesn't looks good.

What's the expected result?

This is website before d7779df merged into main with #12046, which shipped with [email protected]

2024-12-11.23-13-02.mp4

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-tgfpwccu

Participation

  • I am willing to submit a pull request for this issue.
@github-actions github-actions bot added the needs triage Issue needs to be triaged label Dec 11, 2024
@martrapp martrapp added - P2: has workaround Bug, but has workaround (priority) feat: view transitions Related to the View Transitions feature (scope) and removed needs triage Issue needs to be triaged labels Dec 12, 2024
@martrapp
Copy link
Member

Hi @wolf-yuan-6115 👋🏼, yes you are right! The mix-blend-mode settings only work for a real cross fade. As the simulation on Firefox does a fade-out followed by a fade-in, this looks bad.

As a temporary fix you might try to revert the effects by redefining the key frames in your global CSS styles:

@keyframes astroFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@keyframes astroFadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

@wolf-yuan-6115
Copy link
Author

Hi @wolf-yuan-6115 👋🏼, yes you are right! The mix-blend-mode settings only work for a real cross fade. As the simulation on Firefox does a fade-out followed by a fade-in, this looks bad.

As a temporary fix you might try to revert the effects by redefining the key frames in your global CSS styles:

@keyframes astroFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@keyframes astroFadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

Looks good, I'll try to find a way to get around this issue.

@martrapp
Copy link
Member

Should be possible to make Astro generate smarter styles, but i am not sure yet how much effort that will require

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- P2: has workaround Bug, but has workaround (priority) feat: view transitions Related to the View Transitions feature (scope)
Projects
None yet
Development

No branches or pull requests

2 participants