Forum Moderators: not2easy

Message Too Old, No Replies

Bug in Firefox 2 on Mac

Scrollbar visible through 'hidden' overflow mask

         

Fotiman

3:20 pm on Jul 17, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Scenerio:
I have a box that is 100x100. If the content in that box is greater than 100px high, the box becomes scrollable (overflow: auto). I want the scrollbars to be hidden, but allow the scroll wheel on the mouse to work. To achieve this, I create a "mask" that is 100x100 with overflow: hidden. It resembles this:


+------------------+
¦+------------------------+
¦¦.................¦,,,,¦^¦
¦¦.................¦,,,,¦:¦
¦¦.................¦,,,,¦:¦
¦¦.................¦,,,,¦:¦
¦¦.................¦,,,,¦:¦
+------------------+,,,,¦:¦
¦,,,,,,,,,,,,,,,,,,,,,,¦:¦
¦,,,,,,,,,,,,,,,,,,,,,,¦:¦
¦______________________¦V¦
¦<::::::::::::::::::::>¦X¦
+------------------------+

In the diagram above:
. = visible content area
, = hidden content area
: = hidden scrollbar

The problem is that for Firefox on the Mac, the scrollbar shows through even though it is hidden. It works correctly in IE and Firefox on the PC, it is only on the Mac where this is a problem. Does anyone know of a workaround? Below is the test case. Thanks.


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" >
<style type="text/css">
#mask {
position: relative;
background-color: #ccc;
width: 100px;
height: 100px;
overflow: hidden;
}
#scrollableContent {
position: absolute;
top: 0;
left: 0;
width: 120px; /* big enough to hide scrollbar */
height: 120px; /* big enough to hide scrollbar */
overflow: auto;
}
</style>
<title>Untitled</title>
</head>
<body>
<div id="mask">
<div id="scrollableContent">
<ol>
<li>...</li>
<li>...</li>
<li>...</li>
<li>...</li>
<li>...</li>
<li>...</li>
<li>...</li>
<li>...</li>
<li>...</li>
<li>...</li>
<li>...</li>
<li>...</li>
<li>...</li>
<li>...</li>
<li>...</li>
</ol>
</div>
</div>
</body>
</html>

Fotiman

3:36 pm on Jul 17, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



So just to clarify, instead of seeing this:

+-----------------+
¦1. ...~~~~~~~~~~~¦
¦2. ...~~~~~~~~~~~¦
¦3. ...~~~~~~~~~~~¦
¦4. ...~~~~~~~~~~~¦
¦5. ...~~~~~~~~~~~¦
¦6. ...~~~~~~~~~~~¦
+-----------------+

I see something like this (on the Mac only):


+-----------------+
¦1. ...~~~~~~~~~~~¦ ¦^¦
¦2. ...~~~~~~~~~~~¦ ¦:¦
¦3. ...~~~~~~~~~~~¦ ¦:¦
¦4. ...~~~~~~~~~~~¦ ¦:¦
¦5. ...~~~~~~~~~~~¦ ¦:¦
¦6. ...~~~~~~~~~~~¦ ¦:¦
+-----------------+ ¦:¦
,,,,,,,,,,,,,,,,,,,,¦V¦

SuzyUK

9:37 pm on Jul 17, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



don't know fotiman, & don't have a mac to test either.

have you tried using a right/bottom border of 20px (on #mask) instead of the extra width/height to see if that covers the scrollbar? Though it's just a thought I don't think it will make a difference but might be worth a try. I wonder if this a z-index thing (for the scroll bar) - like IE's windowed controls, but how to get the scrollable div under the mask and still have it scroll?

maybe placing the mask on top of the scrollbar (enforced by z-index) would do it, but unless the scroll still works through the transparency not hopeful for that either

Fotiman

3:22 am on Jul 18, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I tried setting different z-indexes, but that didn't seem to help. It seems very much like the <select> box issue in IE6. Maybe I need an iframe shim to fix it, I don't know.

I'll give your border suggestion a try tomorrow. Thanks for the suggestion.