Chrome: element above css transitioning element disappears until transition finishes - css

There are so many questions about Chrome and css transitions that I'm not sure if this has been asked before.
My situation is this: I have a layout that is basically a left and right split page. A box of content from the right side needs to be displayed over the content on the left side (I have no say in this, the design between desktop and mobile makes this necessary). The issue comes when transitioning images that are in the left side. The images are 0 opacity by default and displayed by applying an .active class to the appropriate image that sets its opacity to 1. I'm using css transition to animate it.
When the animation takes place, the box from the right side disappears until the transition is finished. The images in the left side do not layer over the top of it, it's not a background issue, and no matter what I set the z-index of the left and right side the right side box positioned over the left content disappears until the transition is finished.
Code example
<div>blah</div>
<div>another div</div>
<p>meh</p>
Here's a plunker to illustrate the issue (only occurs in Chrome): http://plnkr.co/edit/G2Ohg01PodUKN1xi2izq?p=preview
(seriously, you have to include code to link to plunker, what's the point of plunker then?)
None of the other issues I've seen have addressed this situation. Everything else I've seen has been about issues with the transitioning elements themselves and not elements in completely different code blocks positioned over those transitioning elements.
Any ideas on how this can be overcome or should I just tell the designers "deal with it"?

I'm just gonna take a stab in the dark and assume it's the white text. It's the only thing that's disappearing on the page when the transition is enacted.
your rule for .rightside .right-content has some CSS that's causing this behavior. Remove it and you should be good to go.
Your code:
.rightside .right-content {
position: relative;
z-index: 1;
padding: 1em 1em 3em;
/* overflow:hidden; ------------- Commented this.*/
float: left;
box-sizing: border-box;
width: 100%;
}
The .rightside container isn't allowing its overflow to be displayed, and the transitions are failing to animate this.
Your demonstration returned:
http://plnkr.co/edit/5C2cCZqnB4x7MTdeCGAn?p=preview
Codepen Alternative:
http://codepen.io/anon/pen/BzEkEP

Related

Very strange bug with box-shadow, perspective, overflow and backface-visibility: hidden in Google Chrome

I've ran into a very strange rendering behavior in Google Chrome recently. If you use the exact combination of CSS described in this fiddle (except for transition, it is just for demonstration purposes):
https://jsfiddle.net/yjtpjstx/1/
.wrapper {
perspective: 1px;
overflow: hidden;
box-shadow: 0 0 21px black;
}
.content {
backface-visibility: hidden;
}
You get elements to appear lower and to the right than they actually are.
If your parent element has any perspective, any overflow (hidden, auto, scroll - they all will do) and a box shadow with a blur, and your child element has backface-visibility: hidden then everything inside that child element appears shifted down and to the right for the amount of pixels defined in parent's box shadow. Elements are actually still where they should be, they just move visually. Try clicking the button in the fiddle and mind that it's actually in the top left of parent with shadow.
Any thoughts on what the hell is going on here and how to fix it? Doesn't happen in Firefox. Temporarly I had to remove perspective but I have some animations in real situation that now look dull without the perspective. Could probably get rid of the shadow and make it some other way and I probably will since I don't think this can be fixed but I just wanted to share this with the world, brief googling doesn't seem to indicate this was encountered before.
Seems to be fixed in newer versions of Chrome.

Centering a Modal for IE9 with a transparent background, why need position relative?

The back story....
I'm creating a modal directive for AngularJS that should take any** content and display it centered in the page with a grey transparent background. Sounds like it should be simple. It was working fine until testing w/ IE9 which is the only browser we need to support. Its an in-house site. I have a fiddler working with it centered both vertically and horizontally, that probably could be cleaned up a little. I'm assuming that its going to work, I'm on a mac right now.
The modal's html needs to be in the footer which is fixed to the bottom of the page. So
So I have two questions.
1st- When I was setting up the grey transparent background found that I needed so set the position as relative. Why is this needed? fiddler
.dialogbox-wrapper{
z-index:1000;
display: table-cell;
vertical-align: middle;
/* When this isnt included this has the opacity */
position:relative;
}
2nd- We are using less and CSS3. Is there a cleaner way?
Here's what I need -
Before anyone suggests !doctype HTML, its there.
As to #1
For z-index to be honored, an element must have position of some kind. If position: relative is simply removed, then the default static position does not recognize the z-index: 1000 and so the gray box's z-index: 50 puts your "background" to the foreground.
As to #2
"Cleaner" can be so relative. Here is a modified version of your fiddle that centers it without the need for the min-width (which you expressed in your notations wanting to eliminate), by using display: inline-block with the container set to text-align: center (which is reset on the element itself). It also sets the <a> element for the "close" to display: block so that your width: 200px actually does something (an anchor is an inline element normally, which does not honor width). Of course, now 200px for the .row is driving the width of the modal display.
It all works in IE9 for me.

Explain this modal behavior with z-index and position?

I actually solved this issue for myself but was wondering if anyone could explain why my fix works. I was styling a popup modal on a mobile site using the MoovWeb SDK and sass. The modal consists of a mask div, which is located immediately inside a container div, and the modal div itself, which was buried more deeply in the DOM.
mask styling:
#modalMask{
opacity: .8;
position: absolute;
display:none;
height:100%;
width: 100%;
z-index:9990;
}
modal styling:
.mw-popup-modal {
top: 80px !important;
left: 0 !important;
position:fixed;
z-index:9999;
display:none;
}
This resulted in the mask sitting on top of the modal and the buttons inside the modal being un-tappable - their tap area was actually located around 3cm below where the button was appearing onscreen on the phone. However, on the desktop version of the site, this styling looked fine.
When I changed the positioning of the modal from "fixed" to "absolute" this fixed the problem, but I'd like to understand why. Do fixed- and absolute-positioned elements each work on their own z-index stack?
Official W3 documentation states
Fixed positioning is a subcategory of absolute positioning. The only difference is that for a fixed positioned box, the containing block is established by the viewport. For continuous media, fixed boxes do not move when the document is scrolled. In this respect, they are similar to fixed background images.
Absolute and Fixed positioning do not work on their own z-index stack context.

iScroll prevents my div from showing (when implementing div slider)

I'm trying to implement a div slider into a standard iScroll HTML page, please see the below links:
With iScroll (slide not working properly):
http://utvecklingspunkten.se/iscroll.html
Without iScroll (slide working):
http://utvecklingspunkten.se/iscroll2.html
For some reason, iScroll hides the content (not the div containing it!) in the second div slide. The div containing the content is there allright and it's corretly possitioned (have a look in the console), but the content is simply hidden by iScroll. When removing all references to iScroll, as in iscroll2.html, everything works as it should.
Wrapper containing both slides:
#wrapper {
position:absolute; z-index:1;
top:45px; bottom:2px; left:0;
background:#aaa;
-webkit-transition-property: left;
-webkit-transition-duration: 400ms;
display:block !important;
}
Each sliding element:
.additional-block {
position: absolute;
display:block !important;
}
Does anyone know how I can make iScroll and the slider to work together, and not interfere? Hopefully, there's only a line of code or two in iscroll.js that need to be changed. Likewise, an iScroll div (like the artificial scrollbar) overlaping my second slide div is another possible reason. Pointing this out for me would be greatly appreciated. Thanks!
Try using jQuery Slider, you can style it inside out. Plus you have there already mouse dragging and scrolling ( which actually works ).

Horizontal Navigation with Angled Side Borders - How to handle "Active" state?

I'm looking for a bit of brainstorming assistance.
I am coding a layout that was put together by a designer and am trying to think of a way to handle a horizontal navigation that has angled edges, and goes from a blue background, to a white background when a link is selected.
I'll actually just include a screenshot. This is actually the navigation for a Tabbed content area. The top half of the screenshot shows what it will look like when the first tab is selected. The bottom half of the screenshot shows the 2nd tab selected.
http://i.stack.imgur.com/P34yI.gif
So my problem comes from the fact that HTML elements are rectangles, not rectangles with angled edges. I saved the angled edge with the shadow as a CSS background, and that worked fine, until I realized that each link can turn white and the BG image has a bit of the next link embedded in it to give the illusion of the angle, and thus the left most link would need a different background then the middle link, and the right most link, etc...
I could assign a unique class / id (or use nth child) to each link, but I would like to keep the solution flexible so I can add another link/tab in the future.
I was curious if anyone had any ideas on how to create this appearance by possibly using CSS3 / HTML5 / or some transparent PNG and negative margins or relative positioning?
I'm not asking for code or for you to do my work for me :) I'm just looking for ideas - just a bit of community brainstorming. If anyone has any suggestions please let me know, it might lead me to a solution.
Thanks!!
Assuming you're using a 'ul > li > a' structure for the menu, I would use two angled backgrounds (right and left... the right one is about 27px with the shadow, the left about 22px). Apply the left corner to the <li>, and the right corner to the <a>. That will give you doubled backgrounds on each list item, so you should use negative margins on each side of the <li> to pull its siblings to overlap. Then use z-index to make sure on hover or highlight that the menu item shows up on top of the others. I've added an additional 30px of padding on both sides to create the extra space around the text:
li {
margin-right: -27px;
margin-left: -22px;
padding-left: 52px;
position: relative;
background: url(leftcorner.jpg) left top no-repeat;
background-color: #3aa1cc
}
li a {
padding-right: 57px;
background: url(rightcorner.jpg) right top
}
li:hover {z-index: 5; background: url(leftcorner-hover.jpg) left top no-repeat}
li:hover a {background: url(rightcorner-hover.jpg) left top no-repeat}
I haven't tested this but I think it should work... possibly with some additional tweaking.
This solution doesn't include the subtle inner shadow... to do that you would have to use a 1px repeating gradient background on the <li> then use :before and :after pseudo elements for the two corner background images.
Additionally in my code I put two seperate .jpgs (normal and hover) but really you should use a sprite and background-position so there is no flash while the hover state image is loading.

Resources