<p>When using IE, you cannot put an absolutely positioned div over a select input element. That's because the select element is considered an ActiveX object and is on top of every HTML element in the page.</p>

<p>I already saw people hiding selects when opening a popup div, that leads to pretty bad user experience having controls disappearing.</p>

<p>FogBugz actually had a pretty smart solution (before v6) of turning every select into text boxes when a popup was displayed. This solved the bug and tricked the user eye but the behavior was not perfect.</p>

<p>Another solution is in FogBugz 6 where they no more use the select element and recoded it everywhere.</p>

<p>Last solution I currently use is messing up the IE rendering engine and force it to render the absolutely positioned <code>&lt;div&gt;</code> as an ActiveX element too, ensuring it can live over a select element. This is achieved by placing an invisible <code>&lt;iframe&gt;</code> inside the <code>&lt;div&gt;</code> and styling it with:</p>

<pre class="lang-css prettyprint-override"><code>#MyDiv iframe
{
    position: absolute;
    z-index: -1;
    filter: mask();
    border: 0;
    margin: 0;
    padding: 0;
    top: 0;
    left: 0;
    width: 9999px;
    height: 9999px;
    overflow: hidden;
}
</code></pre>

<p>Does anyone have an even better solution than this one?</p>

<p>EDIT: The purpose of this question is as much informative as it is a real question. I find the <code>&lt;iframe&gt;</code> trick to be a good solution, but I am still looking for improvement like removing this <em>ugly useless tag</em> that degrades accessibility.</p>

[{'answer_id': 7942, 'author': 'TheSmurf', 'author_id': 1975282, 'author_profile': 'https://Stackoverflow.com/users/1975282', 'pm_score': 0, 'selected': False, 'text': "<p>I don't think there is. I've tried to solve this problem at my job. Hiding the select control was the best we could come up with (being a corporate shop with a captive audience, user experience doesn't usually factor into the PM's decisions). </p>\n\n<p>From what I could gather online when looking for a solution, there's just no good solution to this. I like the FogBugz solution (the same thing done by a lot of high-profile sites, like Facebook), and this is actually what I use in my own projects.</p>\n"}, {'answer_id': 7955, 'author': 'BlaM', 'author_id': 999, 'author_profile': 'https://Stackoverflow.com/users/999', 'pm_score': 2, 'selected': False, 'text': '<p>As far as I know there are only two options, the better of which is the mentioned usage of an iframe. The other one is hiding all selects when the overlay is shown, leading to an even weirder user experience.</p>\n'}, {'answer_id': 7958, 'author': 'EndangeredMassa', 'author_id': 106, 'author_profile': 'https://Stackoverflow.com/users/106', 'pm_score': 0, 'selected': False, 'text': "<p>I do the same thing with select boxes and Flash. </p>\n\n<p>When using an overlay, hide the underlying objects that would push through. It's not great, but it works. You can use JavaScript to hide the elements just before displaying an overlay, then show them again once you're done.</p>\n\n<p>I try not to mess with iframes unless it's absolutely necessary.</p>\n\n<p>The trick of using labels or textboxes instead of select boxes during overlays is neat. I may use that in the future.</p>\n"}, {'answer_id': 13197, 'author': 'Pbearne', 'author_id': 3582, 'author_profile': 'https://Stackoverflow.com/users/3582', 'pm_score': 4, 'selected': True, 'text': "<p>I don't know anything better than an Iframe</p>\n\n<p>But it does occur to me that this could be added in JS by looking for a couple of variables </p>\n\n<ol>\n<li>IE 6</li>\n<li>A high Z-Index (you tend to have to set a z-index if you are floating a div over)</li>\n<li>A box element</li>\n</ol>\n\n<p>Then a script that looks for these items and just add an iframe layer would be a neat solution</p>\n\n<p>Paul</p>\n"}, {'answer_id': 779360, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 3, 'selected': False, 'text': '<p>Thanks for the iframe hack solution. It\'s ugly and yet still elegant. :)</p>\n\n<p>Just a comment. If you happen to be running your site via SSL, the dummy iframe tag needs to have a src specified, otherwise IE6 is going to complain with a security warning.</p>\n\n<p>example:</p>\n\n<pre>\n\n    &lt;iframe src="javascript:false;">&lt;/iframe>\n\n</pre>\n\n<p>I\'ve seen some people recommend setting src to blank.html ... but I like the javascript way more. Go figure. </p>\n'}, {'answer_id': 1935384, 'author': 'SamGoody', 'author_id': 87520, 'author_profile': 'https://Stackoverflow.com/users/87520', 'pm_score': 0, 'selected': False, 'text': "<p>Mootools has a pretty well heshed out solution using an iframe, called iframeshim.</p>\n\n<p>Not worth including the lib just for this, but if you have it in your project anyway, you should be aware that the 'iframeshim' plugin exists.</p>\n"}, {'answer_id': 2745791, 'author': 'rvil', 'author_id': 329870, 'author_profile': 'https://Stackoverflow.com/users/329870', 'pm_score': 0, 'selected': False, 'text': "<p>There's this simple and straightforward jquery plugin called bgiframe. The developer created it for the sole purpose of solving this issue in ie6.</p>\n\n<p>I've recently used and it works like a charm.</p>\n"}, {'answer_id': 4889051, 'author': 'Luffy', 'author_id': 447673, 'author_profile': 'https://Stackoverflow.com/users/447673', 'pm_score': 1, 'selected': False, 'text': '<p>try this plugin <a href="http://docs.jquery.com/Plugins/bgiframe" rel="nofollow">http://docs.jquery.com/Plugins/bgiframe</a> , it should work!</p>\n\n<p>usage: <code>$(\'.your-dropdown-menu\').bgiframe();</code></p>\n'}, {'answer_id': 6215563, 'author': 'iDevGeek', 'author_id': 472365, 'author_profile': 'https://Stackoverflow.com/users/472365', 'pm_score': 0, 'selected': False, 'text': '<p>When hiding the select elements hide them by setting the "visibility: hidden" instead of display: none otherwise the browser will re-flow the document.</p>\n'}, {'answer_id': 42917068, 'author': 'Sacky San', 'author_id': 5076414, 'author_profile': 'https://Stackoverflow.com/users/5076414', 'pm_score': 0, 'selected': False, 'text': '<p>I fixed this by hiding the select components using CSS when a dialog or overlay is displayed: </p>\n\n<blockquote>\n  <p>selects[i].style.visibility = "hidden";</p>\n</blockquote>\n\n<pre><code>function showOverlay() {\n    el = document.getElementById("overlay");\n    el.style.visibility = "visible";\n    selects = document.getElementsByTagName("select");\n    for (var i = 0; i &lt; selects.length; i++) {\n        selects[i].style.visibility = "hidden";\n    }\n}\n\nfunction hideOverlay() {\n    el = document.getElementById("overlay");\n    el.style.visibility = "hidden";\n    var selects = document.getElementsByTagName("select");\n    for (var i = 0; i &lt; selects.length; i++) {\n        selects[i].style.visibility = "visible";\n    }\n}\n</code></pre>\n'}]
['https://Stackoverflow.com/questions/7937', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/268/']