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

I can't get the polyfill to work #163

Open
raphaelgoetter opened this issue Oct 14, 2023 · 7 comments
Open

I can't get the polyfill to work #163

raphaelgoetter opened this issue Oct 14, 2023 · 7 comments

Comments

@raphaelgoetter
Copy link

raphaelgoetter commented Oct 14, 2023

Hello,

I designed a scroll-timeline animation to create horizontal scroll indicators on a list of tabs.

Here's the result : https://codepen.io/raphaelgoetter/pen/vYvMaOZ

image

Code is working fine on Chrome, but I don't understand what's preventing the polyfill from working on Firefox or Safari.

@supports (animation-timeline: view()) {
  .nav-tabs {
    &::after {
      content: "";
      position: sticky;
      right: 0;
      flex-shrink: 0;
      align-self: stretch;
      animation: fade-right linear both;
      animation-timeline: scroll(nearest inline);
      animation-range: 0 50px;
      transform-origin: right;
      background-image: linear-gradient(
        to right,
        transparent,
        rgba(255, 255, 255, 0.5) 50%,
        #fff 80%
      );
    }
  }
}
@keyframes fade-right {
  from {
    width: 100px;
    scale: 1 1;
  }
  to {
    scale: 0 1;
  }
}

Did I do something wrong?

@bramus
Copy link
Collaborator

bramus commented Oct 14, 2023

You are using animation-range with a ScrollTimeline. Currently this is not supported.

Duplicate of #151

@raphaelgoetter
Copy link
Author

Makes sense, thank you!

@raphaelgoetter
Copy link
Author

Well, I tried the polyfill with View() animations on these Codepen :

I added the Polyfill this way :
image

But none of these showcases is working on Firefox or Safari.

@raphaelgoetter
Copy link
Author

This Codepen is applying ScrollTimeline without animation-range and Polyfill doesn't seem to work on Firefox neither:

https://codepen.io/raphaelgoetter/pen/QWzRXgZ

Note : I love scroll-driven animations and all the great stuffs you do, @bramus and @flackr !

@bramus
Copy link
Collaborator

bramus commented Nov 15, 2023

@raphaelgoetter I see a few problems with that last demo you shared:

  1. You are including the polyfill twice: once via the head (Pen Settings > JS) and once in the HTML. This explains the error you’re seeing on the console.
  2. You are using CSS Nesting. The polyfill’s CSS Parser can’t deal with CSS Nesting.

Fixing these two issues already gets me somewhere, as demonstrated in this fork: the top element does something driven by scroll in Safari (but not in Chrome for some reason … 🤔)

Unfortunately I don’t have time right now to investigate this further, but this should already get you on track …

@raphaelgoetter
Copy link
Author

Thank you for these clues !

the top element does something driven by scroll in Safari (but not in Chrome for some reason … 🤔)

Actually it's weirder than ever, your fork :

  • is OK on Safari
  • is very strange on Firefox (background jumps at the end of the scroll)
  • isn't working at all in Chrome

(testing on MacOs)

@Crispi27
Copy link

Crispi27 commented Dec 24, 2023

Hi!

Does someone know if the polyfill works with next js? I have tried multiple configurations but have not been able to make it.

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

No branches or pull requests

3 participants