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

Feature Proposal: allowed animations #3

Open
jpchase opened this issue Apr 26, 2018 · 5 comments
Open

Feature Proposal: allowed animations #3

jpchase opened this issue Apr 26, 2018 · 5 comments

Comments

@jpchase
Copy link
Contributor

jpchase commented Apr 26, 2018

See the explainer.

@ehsan-karamad
Copy link

The explainer mostly discusses CSS-defined animations. I am reviving this thread to get insights into expansion of the feature to do even more.

  1. WebAnimation API: I think the feature should support this as well.

  2. DOM manipulations using JavaScript: this is a bit harder but we might at least break it down into smaller use cases which can be blocked or warned against using this feature. Some options:
    2.1 requestAnimaitonFrame: This is a preferred way of manipulating DOM if there is need for it, but perhaps the animations feature could restrict the type of style and property changes that can be modified during a requestAnimationFrame callback.
    2.2 setTimeout: Perhaps any modifications should at least lead to a warning here.
    2.3 All scripts: Warn/throw (depending on the change) whenever Javscript leads to style/layout changes.

@appsforartists
Copy link

That link is broken. Did you mean https://github.com/WICG/feature-policy/blob/master/policies/animations.md?

@appsforartists
Copy link

I hope this doesn't become mandatory, and maybe not even recommended.

Hardware acceleration can be a bit of a cargo cult. It's usually more performant to composite than to repaint, but that's not universally true. For instance, I've tried to implement a 9-patch composited resize, but just tweening width and height on a single element seems to be faster. It seems that, like all other web development, the best results come from trying things and measuring the results.

@ehsan-karamad
Copy link

Yes, the same explainer document.

Thanks for the feedback. Interesting point! I don't think it will become "mandatory" by any means, but it can be come a customizeable feature where a certain set of enabled/disabled animations are recommended. Understandable the recommended set should contain the changes which could to lead to noticeable (positive) changes.

I should mention that the explainer is a first draft and as hinted at the end of the document, the intention is to have this feature implemented as parameterized feature. So the developers should be able to turn on and off certain types of animations and run the measurements and decide what works best for them.

Ideally, one could block changing element.style.left but allow element.width. It might also be that blocking element.style.left leads to performance boost on a set of web pages and ineffective or event costly somewhere else; so back to your point about trials and measurements. FWIW making the animations feature more granular in terms of what it can block should help with finer measurements and more custom trials.

@Malvoz
Copy link

Malvoz commented Oct 2, 2019

FWIW, I'd be interested in only allowing animations if the user hasn't explicitly expressed that they do not want animations/motion, i.e. @media (prefers-reduced-motion: reduce).

Edit: Maybe Client-Hints (specifically https://github.com/WICG/ua-client-hints?) could solve this, as authors could just respond with a different Feature-Policy based on the media query condition? Instead of (somehow) baking user-preferences into this policy, which would only make this more complex.

@clelland clelland transferred this issue from w3c/webappsec-permissions-policy Dec 1, 2020
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

4 participants