Error » Web Related Error!! » Mozilla firefox error » Will It Float?”- Mac, Firefox, Scrollbars and Floating Pop-up Windows

Mozilla firefox error all error and bug related to Mozilla firefox

Post New Thread Reply
  Will It Float?”- Mac, Firefox, Scrollbars and Floating Pop-up Windows
LinkBack Thread Tools Display Modes
Old 30-Dec-2006, 09:52 PM   #1 (permalink)
Administrator
 
Anilrgowda's Avatar

Posts: 18,762
Join Date: Jan 2006
Rep Power: 10 Anilrgowda is on a distinguished road

IM:
Default Will It Float?”- Mac, Firefox, Scrollbars and Floating Pop-up Windows



Problem:
We’ve recently come across an interesting issue with implementing floating pop-up windows (such as notes, etc) on Mac OSX/Firefox/Mozilla/Gecko browsers.
The issue is with displaying floating content that “floats” above areas with scrollbars.
Firefox and Mozilla/Gecko browsers on Macintosh OSX operating systems suffer from a scrollbar rendering bug that causes scrollbars on DIV elements (DIV CSS ‘overflow:scroll;‘ or ‘overflow:auto;‘ with overflowing content) to be rendered outside the layer ordering in the DOM hierarchy. This is a known and documented Mozilla bug having to do with their use of the OS UI chrome on the Mac and the inability to control when the scrollbars are rendered (see [https://bugzilla.mozilla.org/show_bug.cgi?id=187435] for details).
The upshot of this is that if you try to display content ABOVE such a scrollbar, or hide an element containing such scrollbars, these scrollbars remain visible - creating a very noticeable display bug. The Mozilla bug report doesn’t offer a good solution for how the problem presents in the Krugle application (although comments put together get you almost entirely there), so we recently decided to see if we could tackle the issue. The following documents our solution to this issue.
In “Example 1″ we can see what happens when the floating window is placed above a scrollbar, the underlying scrollbar is visible and appears to be above the floating window content.
Example 1 / Problem 1: Underlying Scrollbars Bleedthrough:

The issue doesn’t stop at just displaying the content. When content is hidden (see “Example 2″) the remnants of the floating window still linger, such as masked underlying contents and left-over scrollbars from the floating content.
Example 2 / Problem 2: Hidden Scrollbars Visible (after the “Close” button was clicked):

As mentioned in Mozilla’s bug report (https://bugzilla.mozilla.org/show_bug.cgi?id=187435), this issue only occurs on the Mac and has to do with draw/re-draw order of operations (see comments 38 and 39 for more info).
So what now? How do we get around this (at least until this issue is resolved)?
Well, there are several approaches to solving this, almost all involve setting the overflow attribute of the <div> tag to auto (and in some cases setting it back). But first, let’s start by reproducing this.
Reproducing the problem:
I have created two test pages that demonstrate both the problem and the solution (page 1, page 2). Naturally, you’ll need to be on Mac OSX with Firefox/Mozilla/Gecko browser to see the problem.
Test case (both pages):
Click on “Example 1″ button to see the problem
Click “Close” button inside the floating pop-up window to close it
Click on “Example 2″ button to see the problem partially solved (notice the borders)
Click “Close” button inside the floating pop-up window to close it, this closes/hides the pop-up window, however now we see problem demonstrated in the “Problem 2 Hidden Scrollbars Visible” (above). Click “Reload” button to reset the page
Click on “Example 2″ button (again) to see the problem partially solved (notice the borders)
Click “Close (Fixed)” button inside the floating pop-up window to close it, now we have a clean close with no artifacts remaining
Click on “Example 3″ button to see the problem fully solved
Click “Close” button inside the floating pop-up window to close it, this closes/hides the pop-up window, however now we see problem demonstrated in the “Problem 2 Hidden Scrollbars Visible” (above). Click “Reload” button to reset the page
Click on “Example 3″ button (again) to see the problem partially solved (notice the borders)
Click “Close (Fixed)” button inside the floating pop-up window to close it, now we have a clean close with no artifacts remaining
Solution:
Both pages rely on setting the overflow attribute of the <div> tag to auto. Both work in all the major browsers.
Overlap test 1:
In this example we employ a technique that is a bit more costly than some of the others, both in terms of resources used and operations performed, but it causes less problems if you have multi-tier popups/divs (for example a pop-up that opens up on top of another).
Technique for solving “Problem 1″ (Underlying Scrollbars Bleedthrough)::
Create a child <div> and with overflow set to auto and populate it’s innerHTML with what previously was windows innerHTML
function showWindowFixed(id){ var win = document.getElementById(id); if (!document.getElementById(id + "_child")) { win.innerHTML = "<div style='overflow:auto;' id='" + id + "_child'>" + win.innerHTML + "</div>"; } win.style.visibility = "visible"; win.style.display = "inline";}Technique for solving “Problem 2″ (Hidden Scrollbars Visible):
Change display of the parent div to none (don’t forget to set it back to inline or block when showing the window again).
function hideWindowFixed(id){ var win = document.getElementById(id); win.style.visibility = "hidden"; win.style.display = "none";}Overlap test 2:
The technique used here seems a bit more efficient, both in terms of amount of code and operations used. However this technique, sometimes, causes some residual problems with re-drawing of the scrollbars of the underlying page if multiple tiers/layers are in use.
Technique for solving “Problem 1″ (Underlying Scrollbars Bleedthrough)::
Before displaying the window set the style.overflow to auto
function showWindowFixed(id){ var win = document.getElementById(id); win.style.overflow = "auto"; win.style.visibility = "visible";}Technique for solving “Problem 2″ (Hidden Scrollbars Visible):
Before hiding the window set the style.overflow to hidden. This removes the scrollbars from the element/window.
function hideWindowFixed(id){ var win = document.getElementById(id); win.style.overflow = "hidden"; win.style.visibility = "hidden";}Conclusion:
This solution is not perfect, there are still some side-effects, for example if a pop-up is open and is on top of an underlying scroollbar, the underlying scrollbars will re-appear/bleed through on the next redraw (for example if one switches tabs/windows back and forth). One thought was to play with window.onfocus event and flip the style.overlow attribute from hidden to auto (with 1 millisecond delay). The problem with this approach is that onfocus event propagates to window’s child elements and causes the function to fire more often than desired, the visual side-effect of this is that underlying scrollbars flicker through every time focus changes within the window (for example clicking on links, buttons or within the document).
Anilrgowda is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit!
Reply With Quote
   


   
Post New Thread Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump


All times are GMT -8. The time now is 02:51 PM.

Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0

DMCA Policy

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231