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
[@angular/animations] ViewEncapsulation.ShadowDom breaks Angular Animations #25672
Comments
triaged this with @matsko today, turns out this has never worked (!), even with the previous implementation of Shadow DOM. Definitely a bug. |
Any fixes for this? |
Yes, confirming. I have shadowdom on my web components and hammerjs specified in main.ts. Animations not working. If I remove shadowdom, animations work again. |
I was using primeng sidebar and there was a sliding animation to display the sidebar but the sliding animation to close the sidebar broke (cause I set my view encapsulation to shadow dom). I restored the closing animation by inserting -webkit-transition: all 0.2s ease-in-out; I suspect webkit animations are somehow broken if view encapsulation shadow dom is added? Hope this helps someone! |
Can confirm we're seeing this as well, and our instance relies on a staggered animation so the work around is going to be messier than using the animations modules sadly :( |
This is still an issue; I was using the shadowdom when trying to use Angular Elements and then realized that this was breaking it: encapsulation: ViewEncapsulation.ShadowDom, It took quite a while to track that down, at this point if there isn't a fix there should be a console log error or something because it is something that can be detected within the component declaration if (encapsulation != emulated && animations.length > 0) {
console.log('animations may not work properly');
} |
Any update on this? |
Same for me, animations not working on a |
Same for my project. ShadowDom disables "transition" property. I've added manually in CSS transition filed and it's started working, but it's ugly and it's working only for very primitive animations. Any update for this issue? |
Our team faced the same issue while building encapsulated Web Components for a browser extension. Please, let me share some our findings — probably, this could be helpful to get this tricky issue fixed one day. Angular Animations uses different mechanisms depending on a browser:
Web AnimationsWhen Web Animations is used, the issue is caused by the angular/packages/animations/browser/src/render/web_animations/web_animations_driver.ts Line 28 in 877f9ad
As a result, Angular thinks that elements inside shadow DOM are not presented on a page (but just in memory) and skips animation.
CSS KeyframesWhen CSS Keyframes is used, Angular inherits the same issue as with Web Animations (through some shared modules). In addition to this, Angular adds generated CSS with keyframes to the angular/packages/animations/browser/src/render/css_keyframes/css_keyframes_driver.ts Line 107 in 877f9ad
|
@alexeykostevich thx. This monkey-patch fixes it for the web animations case:
|
Somebody knows how to apply the same solution for CSS Keyframes? |
Can confirm this is still an issue in Angular 9 |
Is there a way to force Angular to use Keyframes instead of Web Animations? |
Still an issue in Angular 10 |
Still an issue in Angular with the following versions. |
Closes angular#25672 Signed-off-by: jeripeierSBB <jeremias.peier@sbb.ch>
enhanced AnimationDriver's containsElement method to not only use the native node contains-method but to walk up the DOM tree by also considering shadow elements. Fixing this allows animations to be played if they are placed inside a shadow DOM. Closes angular#25672
enhanced AnimationDriver's containsElement method to not only use the native node contains-method but to walk up the DOM tree by also considering shadow elements. Fixing this allows animations to be played if they are placed inside a shadow DOM. Closes angular#25672
enhanced AnimationDriver's containsElement method to not only use the native node contains-method but to walk up the DOM tree by also considering shadow elements. Fixing this allows animations to be played if they are placed inside a shadow DOM. Closes angular#25672
enhanced AnimationDriver's containsElement method to not only use the native node contains-method but to walk up the DOM tree by also considering shadow elements. Fixing this allows animations to be played if they are placed inside a shadow DOM. Closes angular#25672
Still an issue on Angular 11 |
Any updates on this? |
I'm afraid there is no update on fixing this at the moment. I am at full capacity with getting the new linker stuff ready - but I will take a look at the linked PR when I get a chance. Perhaps early next week. |
just encountered the same issue on Angular 11, we are currently utilizing Angular elements which needed to be in a ShadowDom View Encapsulation. I've been trying to make a simple animation work for two days now only to find out that having our components in a ShadowDom is what breaking the animation. this are my current versions
|
When determining whether to run an animation, the `TransiationAnimationPlayer` checks to see if a DOM element is attached to the document. This is done by checking to see if the element is "contained" by the document body node. Previously, if the element was inside a shadow DOM, the engine would determine that the element was not attached, even if the shadow DOM's host was attached to the document. This commit updates the `containsElement()` method on `AnimationDriver` implementations to also include shadow DOM elements as being contained if their shadow host element is contained. Further, when using CSS keyframes to trigger animations, the styling was always added to the `head` element of the document, even for animations on elements within a shadow DOM. This meant that those elements never receive those styles and the animation would not run. This commit updates the insertion of these styles so that they are added, to the element's "root node", which is the nearest shadow DOM host, or the `head` of the document if the element is not in a shadow DOM. Closes angular#25672
When determining whether to run an animation, the `TransiationAnimationPlayer` checks to see if a DOM element is attached to the document. This is done by checking to see if the element is "contained" by the document body node. Previously, if the element was inside a shadow DOM, the engine would determine that the element was not attached, even if the shadow DOM's host was attached to the document. This commit updates the `containsElement()` method on `AnimationDriver` implementations to also include shadow DOM elements as being contained if their shadow host element is contained. Further, when using CSS keyframes to trigger animations, the styling was always added to the `head` element of the document, even for animations on elements within a shadow DOM. This meant that those elements never receive those styles and the animation would not run. This commit updates the insertion of these styles so that they are added, to the element's "root node", which is the nearest shadow DOM host, or the `head` of the document if the element is not in a shadow DOM. Closes angular#25672
When determining whether to run an animation, the `TransitionAnimationPlayer` checks to see if a DOM element is attached to the document. This is done by checking to see if the element is "contained" by the document body node. Previously, if the element was inside a shadow DOM, the engine would determine that the element was not attached, even if the shadow DOM's host was attached to the document. This commit updates the `containsElement()` method on `AnimationDriver` implementations to also include shadow DOM elements as being contained if their shadow host element is contained. Further, when using CSS keyframes to trigger animations, the styling was always added to the `head` element of the document, even for animations on elements within a shadow DOM. This meant that those elements never receive those styles and the animation would not run. This commit updates the insertion of these styles so that they are added, to the element's "root node", which is the nearest shadow DOM host, or the `head` of the document if the element is not in a shadow DOM. Closes angular#25672
When determining whether to run an animation, the `TransitionAnimationPlayer` checks to see if a DOM element is attached to the document. This is done by checking to see if the element is "contained" by the document body node. Previously, if the element was inside a shadow DOM, the engine would determine that the element was not attached, even if the shadow DOM's host was attached to the document. This commit updates the `containsElement()` method on `AnimationDriver` implementations to also include shadow DOM elements as being contained if their shadow host element is contained. Further, when using CSS keyframes to trigger animations, the styling was always added to the `head` element of the document, even for animations on elements within a shadow DOM. This meant that those elements never receive those styles and the animation would not run. This commit updates the insertion of these styles so that they are added, to the element's "root node", which is the nearest shadow DOM host, or the `head` of the document if the element is not in a shadow DOM. Closes angular#25672
When determining whether to run an animation, the `TransitionAnimationPlayer` checks to see if a DOM element is attached to the document. This is done by checking to see if the element is "contained" by the document body node. Previously, if the element was inside a shadow DOM, the engine would determine that the element was not attached, even if the shadow DOM's host was attached to the document. This commit updates the `containsElement()` method on `AnimationDriver` implementations to also include shadow DOM elements as being contained if their shadow host element is contained. Further, when using CSS keyframes to trigger animations, the styling was always added to the `head` element of the document, even for animations on elements within a shadow DOM. This meant that those elements never receive those styles and the animation would not run. This commit updates the insertion of these styles so that they are added, to the element's "root node", which is the nearest shadow DOM host, or the `head` of the document if the element is not in a shadow DOM. Closes angular#25672
When determining whether to run an animation, the `TransitionAnimationPlayer` checks to see if a DOM element is attached to the document. This is done by checking to see if the element is "contained" by the document body node. Previously, if the element was inside a shadow DOM, the engine would determine that the element was not attached, even if the shadow DOM's host was attached to the document. This commit updates the `containsElement()` method on `AnimationDriver` implementations to also include shadow DOM elements as being contained if their shadow host element is contained. Further, when using CSS keyframes to trigger animations, the styling was always added to the `head` element of the document, even for animations on elements within a shadow DOM. This meant that those elements never receive those styles and the animation would not run. This commit updates the insertion of these styles so that they are added, to the element's "root node", which is the nearest shadow DOM host, or the `head` of the document if the element is not in a shadow DOM. Closes angular#25672
When determining whether to run an animation, the `TransitionAnimationPlayer` checks to see if a DOM element is attached to the document. This is done by checking to see if the element is "contained" by the document body node. Previously, if the element was inside a shadow DOM, the engine would determine that the element was not attached, even if the shadow DOM's host was attached to the document. This commit updates the `containsElement()` method on `AnimationDriver` implementations to also include shadow DOM elements as being contained if their shadow host element is contained. Further, when using CSS keyframes to trigger animations, the styling was always added to the `head` element of the document, even for animations on elements within a shadow DOM. This meant that those elements never receive those styles and the animation would not run. This commit updates the insertion of these styles so that they are added, to the element's "root node", which is the nearest shadow DOM host, or the `head` of the document if the element is not in a shadow DOM. Closes angular#25672
When determining whether to run an animation, the `TransitionAnimationPlayer` checks to see if a DOM element is attached to the document. This is done by checking to see if the element is "contained" by the document body node. Previously, if the element was inside a shadow DOM, the engine would determine that the element was not attached, even if the shadow DOM's host was attached to the document. This commit updates the `containsElement()` method on `AnimationDriver` implementations to also include shadow DOM elements as being contained if their shadow host element is contained. Further, when using CSS keyframes to trigger animations, the styling was always added to the `head` element of the document, even for animations on elements within a shadow DOM. This meant that those elements never receive those styles and the animation would not run. This commit updates the insertion of these styles so that they are added, to the element's "root node", which is the nearest shadow DOM host, or the `head` of the document if the element is not in a shadow DOM. Closes angular#25672
When determining whether to run an animation, the `TransitionAnimationPlayer` checks to see if a DOM element is attached to the document. This is done by checking to see if the element is "contained" by the document body node. Previously, if the element was inside a shadow DOM, the engine would determine that the element was not attached, even if the shadow DOM's host was attached to the document. This commit updates the `containsElement()` method on `AnimationDriver` implementations to also include shadow DOM elements as being contained if their shadow host element is contained. Further, when using CSS keyframes to trigger animations, the styling was always added to the `head` element of the document, even for animations on elements within a shadow DOM. This meant that those elements never receive those styles and the animation would not run. This commit updates the insertion of these styles so that they are added, to the element's "root node", which is the nearest shadow DOM host, or the `head` of the document if the element is not in a shadow DOM. Closes angular#25672
When determining whether to run an animation, the `TransitionAnimationPlayer` checks to see if a DOM element is attached to the document. This is done by checking to see if the element is "contained" by the document body node. Previously, if the element was inside a shadow DOM, the engine would determine that the element was not attached, even if the shadow DOM's host was attached to the document. This commit updates the `containsElement()` method on `AnimationDriver` implementations to also include shadow DOM elements as being contained if their shadow host element is contained. Further, when using CSS keyframes to trigger animations, the styling was always added to the `head` element of the document, even for animations on elements within a shadow DOM. This meant that those elements never receive those styles and the animation would not run. This commit updates the insertion of these styles so that they are added, to the element's "root node", which is the nearest shadow DOM host, or the `head` of the document if the element is not in a shadow DOM. Closes angular#25672
When determining whether to run an animation, the `TransitionAnimationPlayer` checks to see if a DOM element is attached to the document. This is done by checking to see if the element is "contained" by the document body node. Previously, if the element was inside a shadow DOM, the engine would determine that the element was not attached, even if the shadow DOM's host was attached to the document. This commit updates the `containsElement()` method on `AnimationDriver` implementations to also include shadow DOM elements as being contained if their shadow host element is contained. Further, when using CSS keyframes to trigger animations, the styling was always added to the `head` element of the document, even for animations on elements within a shadow DOM. This meant that those elements never receive those styles and the animation would not run. This commit updates the insertion of these styles so that they are added, to the element's "root node", which is the nearest shadow DOM host, or the `head` of the document if the element is not in a shadow DOM. Closes angular#25672
When determining whether to run an animation, the `TransitionAnimationPlayer` checks to see if a DOM element is attached to the document. This is done by checking to see if the element is "contained" by the document body node. Previously, if the element was inside a shadow DOM, the engine would determine that the element was not attached, even if the shadow DOM's host was attached to the document. This commit updates the `containsElement()` method on `AnimationDriver` implementations to also include shadow DOM elements as being contained if their shadow host element is contained. Further, when using CSS keyframes to trigger animations, the styling was always added to the `head` element of the document, even for animations on elements within a shadow DOM. This meant that those elements never receive those styles and the animation would not run. This commit updates the insertion of these styles so that they are added, to the element's "root node", which is the nearest shadow DOM host, or the `head` of the document if the element is not in a shadow DOM. Closes #25672 PR Close #40134
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
I'm submitting a...
Current behavior
As title mentioned, setting
ViewEncapsulation.ShadowDom
will cause the Animations not being able to run at all. Use-case: I'm building an Angular Element in conjunction with Angular Animations to see if the two play well together.Expected behavior
Setting
ShadowDom
Encapsulation strategy should work with Angular Animations.Minimal reproduction of the problem with instructions
What is the motivation / use case for changing the behavior?
Environment
The text was updated successfully, but these errors were encountered: