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

Beware of overflow: hidden, it breaks z-translation quite badly #493

Closed
IjzerenHein opened this issue Nov 24, 2014 · 28 comments
Closed

Beware of overflow: hidden, it breaks z-translation quite badly #493

IjzerenHein opened this issue Nov 24, 2014 · 28 comments

Comments

@IjzerenHein
Copy link
Contributor

Hi, I've come across a very annoying browser issue that causes the z-translation to not be respected. It happens to renderables inside a ContainerSurface using 'overflow: hidden'. Basically, the z-translation is no longer respected and instead the DOM ordering is used.
Obviously this is not a famo.us bug, but I thought you should know.
Test project: https://github.com/IjzerenHein/famous-zindex

Regards, Hein

@MylesBorins MylesBorins added bug and removed bug labels Nov 24, 2014
@MylesBorins
Copy link
Contributor

Is this happening in all browsers, or only a specific vendor?

@IjzerenHein
Copy link
Contributor Author

Z-ordering issues inside the ContainerSurface seem to happen on Chrome. Z-ordering conflicts outside the ContainerSurface on safari and Firefox, haven't tested with IE though

@michaelobriena
Copy link
Member

Can you provide test cases? This is something we see break often as browsers roll out new versions.

@IjzerenHein
Copy link
Contributor Author

@michaelobriena
Copy link
Member

Fantastic tests. Thanks for sending these.

@michaelobriena
Copy link
Member

Can you send me your browser versions? THanks!

@IjzerenHein
Copy link
Contributor Author

Chrome Version 38.0.2125.122
And the problem also occurs on cordova builds using crosswalk 8.

@michaelobriena
Copy link
Member

I am not sure if I misread your comment 2 hours ago but I am seeing no issues on Safari and Firefox. This seems to be only a Chrome issue for me.

My version of your tests
https://github.com/michaelobriena/famous-zindex

Screenshots:

Chrome 38.0.2125.122:
screen shot 2014-11-24 at 4 02 51 pm

Chrome Canary 41.0.2229.1 canary (64-bit)
screen shot 2014-11-24 at 4 04 05 pm

Safari 7.0.3
screen shot 2014-11-24 at 4 08 32 pm

Firefox 33.1.1
screen shot 2014-11-24 at 4 05 33 pm

Firefox Nightly 36.0a1
screen shot 2014-11-24 at 4 06 21 pm

@michaelobriena
Copy link
Member

Wrong Safari Screenshot. Edited above.

@IjzerenHein
Copy link
Contributor Author

Michael,
In my version I had deliberately placed the 4 tests close to each other to see whether there would be any overlapping issues. This screenshot was taken on Safari 8 but looks the same on Firefox.
screen shot 2014-11-24 at 23 19 31

The surface inside the ContainerSurface at z-translate -50 overlaps the surfaces at z-translate 0 of the top two tests. I'm not sure if this is intended behaviour by the browser, but it looks incorrect to me.

Cheers, Hein

@michaelobriena
Copy link
Member

That is just the bottom right overlapping the top right which is not an issue. The four quadrants are technically at the same z depth as far as the browsers are concerned which means it is just left to DOM order. If you rearrange your code to have the each quadrant render in a different order you will see different results.

@IjzerenHein
Copy link
Contributor Author

Mike,
I'm not so sure about that, the surfaces with the darkest color are all at z-translate -50 and should not overlap the lighter surfaces at z-translate 0 and 50. I have modified the example and removed overflow: hidden on the left-bottom ContainerSurface and then it looks like this:
screen shot 2014-11-25 at 09 44 39
Live demo: http://gloey.nl/apps/zindex2/

When using overflow: hidden, the divs inside the ContainerSurface seem to overlap the divs outside on all major browsers, not respecting the z-translation. This behaviour occurs on Safari and Firefox, so it almost seems by design. Quite strange really.
Cheers

@michaelobriena
Copy link
Member

When outside of the ContainerSurface, essentially think of them as flattening out and existing as a single Surface. The depths of things inside the ContainerSurface does not matter across ContainerSurfaces.

@IjzerenHein
Copy link
Contributor Author

Right, I see. So in that case the z-index of the ContainerSurface itself would be used, is that correct?

@michaelobriena
Copy link
Member

Exactly.

@trusktr
Copy link
Contributor

trusktr commented Feb 8, 2015

@michaelobriena Can you post your version with the quadrants separated?

@trusktr
Copy link
Contributor

trusktr commented Feb 8, 2015

I made a bug for it in the Chromium bug tracker, https://code.google.com/p/chromium/issues/detail?id=456601&thanks=456601&ts=1423425515

@michaelobriena
Copy link
Member

Sorry, I actually just cleaned that up Friday!

@trusktr
Copy link
Contributor

trusktr commented Feb 8, 2015

No prob. hehe

@trusktr
Copy link
Contributor

trusktr commented Feb 13, 2015

Looks like they've confirmed it is a bug on their side: https://code.google.com/p/chromium/issues/detail?id=456601#c2

@trusktr
Copy link
Contributor

trusktr commented Feb 16, 2015

Update: The chromium devs have found the version that caused the break, and are looking to fix it.

@jordangarside
Copy link

Is this the bug I'm experiencing on my page?
My overflow: hidden is broken on my canvas container, and z-translation isn't respected.

Only happens on Chrome Mobile, both 4.4 and 5.0.3. (Firefox Mobile works fine)

Source is available here.

@trusktr
Copy link
Contributor

trusktr commented Mar 22, 2015

@jordangarside What's the expected behavior? What should I see vs what we're actually seeing?

@zackbrown
Copy link
Contributor

I believe Chrome fixed this at one point a few months ago and then regressed.

The bug appears to occur specifically when both transform-style: preserve-3d and overflow: hidden are on the same element. A solution that has worked in the past for Chrome is to use two containers: an outer container with overflow: hidden and an inner container, a child of the former, with transform-style: preserve-3d.

For example, @jordangarside in the example you linked, if you use to chrome inspector to remove the overflow: hidden property from #mainCtx, (since that element's parent, .famous-root also has overflow: hidden and since #mainCtx has transform-style: preserve-3d) z-translation works as expected.

@michaelobriena
Copy link
Member

This has been fixed in Chrome

@IjzerenHein
Copy link
Contributor Author

Awesome! Which version was that?

@michaelobriena
Copy link
Member

@IjzerenHein Unfortunately all I have for you is sometime between today and Nov 24th 2014

@IjzerenHein
Copy link
Contributor Author

Alright, well thanks for sharing that Michael!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants