-
Notifications
You must be signed in to change notification settings - Fork 371
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
Undefined specification for @keyframe scope on slotted content #715
Comments
cc @tabatkins |
Shall this be upstreamed to a relevant CSS spec? |
This was brought up a few months ago, in w3c/csswg-drafts#1516 (and several times in the years prior). I wrote up a proposed solution in w3c/csswg-drafts#1995, but nobody's bitten on the thread. Happy to drive it if anyone's interested, tho. Short form of the proposal:
|
I left a comment on w3c/csswg-drafts#1995 - seems like that is the right place to move this discussion. |
Indeed. The README of this repository now hints at that more clearly. Suggestions for more improvements to our README welcome. |
The specification is missing a definition for the behaviour of
@keyframe
scoping for slotted content. As a result, the two major implementing browsers (Chrome and Safari) show different behaviours.Unspecified behaviour
When an animation is defined on a slotted element like so:
There is no specification that clarifies in which scope the
@keyframes
lookup takes place. (inside the ShadowRoot, or in the scope of the slotted component, in this case the<div>
)Possible resolutions
The lookup takes place inside the scope of the ShadowRoot where the element is slotted.
I consider this the expected behaviour, since the
@keyframes
lookup takes place in the same scope where theanimation-name
is defined in CSS.Safari implements this resolution.
The lookup takes place inside the scope where the element is defined.
I consider this unexpected behaviour. It forces Web Component authors to 'leak' animation definitions outside the ShadowRoot in order to animate slotted content.
Chrome implements this resolution
Reproduction
A reproduction can be found here: https://codepen.io/ruphin/pen/zPQvXw
The animations you see on that page will differ depending on if you are using Safari or Chrome to view the page.
The text was updated successfully, but these errors were encountered: