Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dropdown-menu button's menu renders outside browser window #3614

Closed
inactivist opened this issue May 27, 2012 · 3 comments
Closed

dropdown-menu button's menu renders outside browser window #3614

inactivist opened this issue May 27, 2012 · 3 comments
Labels
Milestone

Comments

@inactivist
Copy link

I'm relatively new to Twitter BS and encountered an odd effect with dropdown buttons. The popup menu renders outside the window/viewport, clipping the popup (and thus rendering it pretty much unusable.) The appearance is very similar to the one described in issue #3107.

JSFiddle example - screen shot:

Screen shot

Consider the following (admittedly unusual) floating div structure:

<div class="pull-left">
    <div class="pull-right">
        <div class="btn-group">                 
                <a class="btn btn-mini dropdown-toggle" data-toggle="dropdown" href="#">
                    <span>Actions</span>
                    <span class="caret"></span>
                </a>
                <ul class="dropdown-menu">
                    <li><a href="#">Item 1</a></li>
                    <li><a href="#">Item 2</a></li>
                    <li><a href="#">Item 3</a></li>
                    <li class="divider"></li>
                    <li><a href="#">Item 4</a></li>
                    <li><a href="#">Item 5</a></li>
                </ul>
            </div>
    </div>
</div>

Patient: "Doctor, it only hurts when I laugh."
Doctor: "Then don't laugh."

I'll admit that I might want to avoid the nested pull-right / pull-left structure, but... is this reasonable behavior from Bootstrap?

I'm using Bootstrap v2.0.3.

@inactivist
Copy link
Author

Workaround: Substitute style="float:left" and style="float:right" for pull-left and pull-right classes, respectively.

Here's a JSFiddle example.

<div style="float:left;">
    <div style="float:right;">
        <div class="btn-group">                 
                <a class="btn btn-mini dropdown-toggle" data-toggle="dropdown" href="#">
                    <span>Actions</span>
                    <span class="caret"></span>
                </a>
                <ul class="dropdown-menu">
                    <li><a href="#">Item 1</a></li>
                    <li><a href="#">Item 2</a></li>
                    <li><a href="#">Item 3</a></li>
                    <li class="divider"></li>
                    <li><a href="#">Item 4</a></li>
                    <li><a href="#">Item 5</a></li>
                </ul>
         </div>
    </div>
</div>

@mdo
Copy link
Member

mdo commented May 28, 2012

We currently do not do anything for positioning elements off screen, but this brings up another bug: we shouldn't be floating the menu like that given the float is on an element above the .btn-group. I've fixed this in 2.0.4-wip.

@Bapu09
Copy link

Bapu09 commented Jun 7, 2013

What about this? How can I do that?
http://jsfiddle.net/Acchg/241/z

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants