I was asked to help out with some CSS animation. I thought it would be no problem. A few hours at most. Boy was I wrong.
The biggest issue I ran into was that an element that came in from the right (outside the boundaries was hidden by overflow
) functioned just fine on desktop Safari and Chrome, but did not appear on iOS unless I ran the debugger and toggled overflow
or display
properties during the transition. position
and z-index
made no difference.
I came across this article while researching solutions. The ending shed some light for me:
ensure you don’t have a CSS property such as transform on the root element. It’s more than likely that this is creating a new stacking context for the enclosed elements.
Whelp, that sucks. CSS animations rely almost solely on the transform
property to operate. I played around a few more hours trying different techniques with containers and positioning. The only thing that sort of worked was using translate3d()
and keeping the element active and in view the entire time. Then and only then did it work the same on iOS and desktop. If it paused or was hidden even for a moment, I couldn’t get it to come back.
Safari on iOS is doing something funky with stacking when the transform
property is involved and I couldn’t find any solid documentation on what is happening in order to come up with a good solution.
If anyone has faced this beast and won, please drop me a line! I can’t post the specific elements here because it was client work, but I’m happy to discuss it one-on-one.
Side note: Webkit is finally moving off of prefixes!