[csswg-drafts] [css-animations-2] Scoping keyframe names between UA and developer styles. (#7560)

khushalsagar has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-animations-2] Scoping keyframe names between UA and developer styles. ==
Currently there is no way to scope keyframe names declared in styles in user-agent origin vs author rules. For example, consider the following declaration in a user agent stylesheet.

```css
@page-transition-fade-in {
  from { opacity: 0; }
}

::page-transition-incoming-image {
    animation: page-transition-fade-in 0.25s both;
  }
}
```

This has 2 problems:

* If the author declares a keyframe with the same name for a different animation, it will incorrectly override the keyframe selected for the rule in the user-agent stylesheet.
* If the keyframe with the same supplied by the author is missing, the declaration in the user-agent stylesheet will be used incorrectly.

We need a way to scope keyframe names between styles in the user-agent origin vs author styles. A couple of options are:

- Come up with a prefix which is reserved for UA rules. It will be an error for author keyframes to use this prefix. This will have compat issues to figure out the right prefix.

- Keep a separate list of keyframes declared in user-agent stylesheets vs author stylesheets. The list chosen when selecting the animation-name depends on where the resolved animation-name came from. This means if the animation-name was specified in a UA stylesheet but overridden by an author style (possibly with the same name), the look up is in author keyframe names.

  One of the caveats with this is script APIs like AnimationEvent include animation-name and which keyframe it corresponds to would be ambiguous. We could add another field to such APIs (bool isUASource) specifying the namespace for the rule.

@flackr @vmpstr @jakearchibald 

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/7560 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Tuesday, 2 August 2022 21:23:39 UTC