W3C home > Mailing lists > Public > www-style@w3.org > July 2011

Re: [css3-animations] Effect of display:none and visibility:hidden on animations

From: Jonathan Snook <jonathan@snook.ca>
Date: Fri, 29 Jul 2011 15:36:34 -0400
Message-Id: <402FC557-4994-46DC-89D8-47E66085327E@snook.ca>
To: www-style@w3.org
(apologies if this comes through twice; the messaging on first sending an email to the list is a little confusing)

So, I've been trying to reconcile some considerations about CSS3 Animations. I talked a bit about them recently and explained keyframes like we were defining classes that were being applied to the element at certain points of time and transitioning values between those times. 

However, currently, non-transitionable properties are ignored. I'd like to suggest that this be changed and I'll give you a particular use case:

   div {

   div.hidden {
       animation: slide-out 1s 1;

In this example, the hidden class is applied to a DIV via JavaScript. The problem is that by setting display:none, neither animations nor transitions will work. I would propose that non-transitionable values be allowed.

@keyframes slide-out {
  0% { display:block; opacity: 1; }
  100% { display:none; opacity:0; }

In this way, the element fades to nothing and then is removed from flow. As you can see by this example, the fall back for browsers that don't support animations is what we want and still accessible (in the sense that we often want things removed from the page for both visual users and screenreader users).

On top of this, I would like to recommend an additional property to animation-direction: reverse. This would allow a declared animation to be run in reverse. For example:

div {
animation: slide 1s 1;

div.hidden {
animation-direction: reverse;

This would allow a single animation declaration to be used.

I detailed these things in a post at:

Thanks for listening to my suggestions.

Received on Saturday, 30 July 2011 05:55:30 UTC

This archive was generated by hypermail 2.4.0 : Monday, 23 January 2023 02:14:02 UTC