Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Timing-function sometimes gets ignored in safari #37440

Closed
David-van-der-Sluijs opened this issue Jun 4, 2020 · 8 comments
Closed

Timing-function sometimes gets ignored in safari #37440

David-van-der-Sluijs opened this issue Jun 4, 2020 · 8 comments

Comments

@David-van-der-Sluijs
Copy link

🐞 bug report

Affected Package

The issue is caused by package @angular/animations

Description

I'm trying to build a animation with angular animations, but if I choose a custom cubic-bezier timing function, it sometimes gets ignored in apple's safari browser (desktop and mobile).

🔬 Minimal Reproduction

https://stackblitz.com/edit/angular-ivy-qyj9rv

Chrome's behavior:
Chrome

Safari's behavior:
Safari

🌍 Your Environment

Angular CLI: 9.1.3
Node: 12.14.1
OS: darwin x64

Angular: 9.1.3
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
Ivy Workspace: Yes

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.901.3
@angular-devkit/build-angular     0.901.3
@angular-devkit/build-optimizer   0.901.3
@angular-devkit/build-webpack     0.901.3
@angular-devkit/core              9.1.3
@angular-devkit/schematics        9.1.3
@ngtools/webpack                  9.1.3
@schematics/angular               9.1.3
@schematics/update                0.901.3
rxjs                              6.5.5
typescript                        3.8.3
webpack                           4.42.0
@ngbot ngbot bot added this to the needsTriage milestone Jun 4, 2020
@sebaferreras
Copy link

sebaferreras commented Jun 7, 2020

@SlateDave I found the same issue some time ago and, as far as I can tell, it doesn't happen sometimes but every time the animation involves adding or removing an element from the DOM as part of the animation.

Please take a look at this demo project: https://stackblitz.com/edit/angular-animations-safari

In the Stackblitz project, I created a very simple component with 5 squares. Each square has a different timing function:

  • Square 1: ease
  • Square 2: ease-in
  • Square 3: ease-out
  • Square 4: cubic-bezier (keeping the element in the DOM)
  • Square 5: cubic-bezier (adding/removing the element to/from the DOM)

When you click Animate 1, 2, 3 and 4, the animation works fine both in Chrome and Safari. You can see that the animation timing function applied to each square is different (which is correct).

But if you click Animate All in Safari, you'll notice that all squares are animated using the same animation timing function even though they all have different timing functions being applied.

Safari-Animation-Bug

Apparently adding or removing the element from the DOM is breaking the animation timing function somehow. Could this be a bug in Safari Webkit?

@David-van-der-Sluijs
Copy link
Author

@sebaferreras I think there is an additional problem besides the one with adding and removing elements. And that is: If you interrupt the animation in the middle, Safari will use the "ease" function for all of them again.

Animation

@sebaferreras
Copy link

@SlateDave You're absolutely right, that's another way of reproducing the issue.

So, so far the issue seems to be happening when:

  1. The animation involves adding or removing an element from the DOM.
  2. The animation is interrupted in the middle (even if it doesn't add or remove anything from the DOM).

@ghost
Copy link

ghost commented Jun 15, 2020

+1

@andrewatwood
Copy link

Nice reproduction. Happens to me with *ngIf based animations, never remembered to file the issue though, so good on you!

@David-van-der-Sluijs
Copy link
Author

Good news! This bug seems to have been fixed on the latest public beta version of macOS Big Sur and iOS 14 for me.

@jelbourn
Copy link
Member

Closing since this seems like it was a WebKit/Safari bug that has been fixed in later versions.

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Nov 26, 2020
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Projects
None yet
Development

No branches or pull requests

5 participants