Posted about 1 month ago. Visible to the public.

Chrome bug: Wrong stacking order when transitioning composited elements

Google Chrome has a subtle rendering bug that hits me once in a while. It usually occurs in sliders with HTML content.

The issue

When a slider contains a composited[1] element, the element will overlap any other element when sliding, being rendered as frontmost element. After the slider has settled, stacking order jumps back to normal.

It seems like Chrome is doing its compositing wrong. This doesn't happen in Firefox.

The cause

The issue only occurs if:

  • two elements A and B are nested inside an element C
  • A overlaps B (partially or fully, e.g. by using z-index)
  • B is rendered in its own layer[1]
  • C is moved with a CSS transition
  • the transition moves A and B in from offscreen

This is wrong: during the transition, B will overlap A.

How to fix

I have not found a real fix for this, but a simple workaround is to also force the overlapping element into its own layer with

Copy
A transform: translate3d(0,0,0)

[1] Forcing elements to be rendered in their own layer is a hack that can improve rendering quality and/or performance. It is achieved by adding CSS properties that require the GPU while not altering the effective element styles. A common property is transform: translate3d(0,0,0). Background.

Does your version of Ruby on Rails still receive security updates?
Rails LTS provides security patches for old versions of Ruby on Rails (3.2 and 2.3).

Owner of this card:

Avatar
Dominik Schöler
Last edit:
about 1 month ago
by Dominik Schöler
About this deck:
We are makandra and do test-driven, agile Ruby on Rails software development.
License for source code
Posted by Dominik Schöler to makandra dev
This website uses cookies to improve usability and analyze traffic.
Accept or learn more