Improve the animation for the review banner.
Review Request #9062 — Created July 8, 2017 and submitted — Latest diff uploaded
The review banner animation code has been the same for a long time. We
used jQuery's slideIn/slideOut functionality, which wasn't really the
best visual. It slid the bottom of the banner up over the contents,
rather than sliding the banner itself out of view. It also just wasn't
particularly fast or smooth.We now use CSS transitions for this instead. The banner starts off in a
non-animated state and is positioned above the page. If there's an
existing draft when loading the page, the banner will be positioned at
the very top of the page, but within the page flow (without using
position: fixed
) instead of docked to the top of the viewport. Only
when the JavaScript for the banner is set up will animations be enabled
and the banner set to be docked.We then animate the max-height/height for the spacer used to push down
the page along with thetransformY
of the banner itself when
showing/hiding the banner.The resulting animation is smoother, as the browser can be smarter about
how it handles the animations and resulting layout, and it's also a
better visual since the entire banner slides in/out of view rather than
the bottom edge.It's worth noting that older browsers that don't support transitions won't
see animations here, whereas in the past they would. Instead, they'll see
the banner simply appear or disappear.
Tested in Firefox, Chrome, and Internet Explorer 9, 11, and Edge.
Tested creating a new draft, discarding/submitting a draft, and
loading the page with/without there being a draft.