4

I've narrowed down my issue to a fairly simple case. This works (in Chrome, at least), displaying a "pop-up" which is mostly off-screen, with a slice of the right hand side on screen. When I hover over the visible part, the whole pop-up slides into view:

<!DOCTYPE html>
<html>
<head>
  <title>Popout test</title>
  <style>
  #popout {
    -webkit-transition: left 0.5s ease-in-out;
    width: 200px;
    height: 200px;
    background-color: #cde;
    border: 4px solid black;
    padding: 4px;
    left: -180px;
    position: absolute;
    top: 250px;

  }

  #popout:hover {
    left: -4px;
  }  
  </style>
</head>
<body>
  <div id="popout">This is a test</div>
</body>
</html>

However, if I then move that exact CSS into an external stylesheet:

<!DOCTYPE html>
<html>
<head>
  <title>Popout test</title>
  <link rel="stylesheet" href="popout.css" />
</head>
<body>
  <div id="popout">This is a test</div>
</body>
</html>

popout.css:

#popout {
    -webkit-transition: left 0.5s ease-in-out;
    width: 200px;
    height: 200px;
    background-color: #cde;
    border: 4px solid black;
    padding: 4px;
    left: -180px;
    position: absolute;
    top: 250px;

}

#popout:hover {
  left: -4px;
}  

...the effect remains the same, but on page load the pop-up appears "popped out" and eases back off screen. With the style directly in a <style> in the html page, as in the first example, this doesn't happen; the pop-up starts "off screen", i.e. at left: -180px as I would expect.

I'm wondering if this is a "flash of unstyled content", with the added annoyance that because of the transition effect, it's actually a very obvious, slow effect?

Can anyone tell me for sure why this happens, and what's the least hacky way to avoid it?

Because of the way jsfiddle works, I can't reproduce the problem there, unfortunately.

Knu
  • 14,806
  • 5
  • 56
  • 89
Matt Gibson
  • 37,886
  • 9
  • 99
  • 128
  • Your HTML is broken, check it is nothing to do with that first.
    This is a test - it should be
    This is a test
    – Kinlan Jun 17 '11 at 14:25
  • @Kinlan Ooops, good point. That's an artifact of me simplifying down to my example; the original code is valid. I've corrected the question. It doesn't affect the problem. – Matt Gibson Jun 17 '11 at 14:56
  • 1
    I tried your sample and it works ok with external stylesheet or without it in chrome. What version of chrome are you using? – easwee Jun 17 '11 at 15:10
  • @easwee I'm using 11.0.696.71 under Windows. So, you don't see the pop up flash up fully on screen and then ease back off-screen on page load? Interesting... – Matt Gibson Jun 17 '11 at 15:17
  • 1
    Might be the load time is just to small on localhost? But i tried to upload the sample on my hosting and it still works ok: http://www.easwee.net/test123/HTMLPage.htm My version is 11.0.696.68. – easwee Jun 17 '11 at 15:33
  • @easwee I'm seeing it on localhost, because the DIV eases over the time defined in the -webkit-transition, so it's taking half a second to happen regardless... And I see the problem in your version, too. Odd. I'll try it under Chrome 12 when I get home and see if it's maybe just a Chrome bug. – Matt Gibson Jun 17 '11 at 15:38
  • 1
    @Matt Gibson - i tried on another pc with latest Chrome fresh instal and it does not happen. No idea what could mess it. Tried in other webkit browsers and it also works ok. – easwee Jun 18 '11 at 17:11
  • @easwee Yes, something odd going on. It *doesn't* happen in Safari for me, but it *does* happen in Chrome 13.0.782.24. Or maybe there's an extension doing something odd -- my extensions are synchronised, so possible that's what's doing it. I'll experiment a bit more. Thanks for checking! – Matt Gibson Jun 18 '11 at 23:24
  • @easwee Found it! Thanks for your help in confirming that it wasn't Chrome specifically that was causing the problem. Turns out it's the AdBlock extension that was causing the problem; presumably it's doing something a little odd to every page on load. – Matt Gibson Jun 18 '11 at 23:34

1 Answers1

3

Thanks, @easwee, for help in confirming what the problem wasn't :) I've now tracked down what's causing the problem. It was the AdBlock extension for Chrome. If I disable this extension, I don't see the problem.

In case it's helpful for anyone else tracking down this problem, you can quickly test to see if an extension is causing an issue by using a new "Incognito" window -- all extensions are disabled for Icognito windows in Chrome.

Matt Gibson
  • 37,886
  • 9
  • 99
  • 128
  • I can confirm that this is not just AdBlock, but Chrome itself. Whether or not it's actually showing a flash of un-styled content, I'm not sure, but I've tested this on Mac in Chrome v12 (current stable) and v14 (current canary) with and without extensions, in and outside of Incognito mode. In Safari it never happens (maybe because Safari delays the render until the CSS is loaded?) – jsejcksn Jun 30 '11 at 19:28
  • It's true that certain extensions in Chrome can cause this to happen repeatedly on refreshes, but when loading the page for the first time, this always happens without a cached stylesheet. Should this be filed as a bug with the Chromium project? – jsejcksn Jun 30 '11 at 19:28
  • @pattern86 Oh, so you're seeing it regardless? Interesting. I've just tried using @easwee's test page, and it definitely *isn't* happening for me in 13.0.782.31 with AdBlock turned off. Haven't tried with other versions yet. If you can reproduce it without extensions, then yes, I guess it's a Chrome bug, though it seems to be a slippery one... Might try with Chrome 14 later, and see what happens there. – Matt Gibson Jul 01 '11 at 06:51
  • Yeah, I'm getting it with his example in incognito mode in both versions. – jsejcksn Jul 02 '11 at 04:28