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

Style input/button tags in dropdowns #10248

Closed
heruan opened this issue Aug 28, 2013 · 7 comments
Closed

Style input/button tags in dropdowns #10248

heruan opened this issue Aug 28, 2013 · 7 comments

Comments

@heruan
Copy link

heruan commented Aug 28, 2013

I'd like to place a <button type="submit"> in a dropdown button group, like this:

<div class="btn-group">
    <button type="submit" name="status" value="pending" class="btn btn-primary">
        Submit as Pending
    </button>
    <button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown"> <span class="caret"></span>
    </button>
    <ul class="dropdown-menu" role="menu">
        <li>
            <button type="submit" name="status" value="working">
                Submit as Working
            </button>
        </li>
        <li>
            <button type="submit" name="status" value="solved">
                Submit as Solved
            </button>
        </li>
        <li>
            <button type="submit" name="status" value="invalid">
                Submit as Invalid
            </button>
        </li>
    </ul>
</div>

It think it could be useful to have form submit buttons in dropdown button groups, but the dropdown style is now applied only to anchors (.dropdown-menu > li > a) and not to inputs or buttons.

@Joyrex
Copy link

Joyrex commented Aug 28, 2013

I might be pointing out the obvious, but shouldn't you have btn btn-* classes on the buttons within the dropdown menu? I say this because I have a search (with appended submit button) inside a dropdown menu and the button has styling.

@heruan
Copy link
Author

heruan commented Aug 28, 2013

Hi @Joyrex and thank you for your reply! Unfortunately btn classes won't help (see http://jsfiddle.net/x6Gr8/).

@mdo
Copy link
Member

mdo commented Sep 1, 2013

Until v4 drops, we cannot change the behavior of the dropdown items, and by that I mean the only way we'd account for this is with required classes on the dropdown links (e.g., .dropdown-item instead of .dropdown > li > a). We could account for this in v3.1 perhaps if we only deprecate the old selectors, but I'm unsure of the trade offs.

I'll make a note to consider this for v3.1 in #9397.

@mdo mdo closed this as completed Sep 1, 2013
@Joyrex
Copy link

Joyrex commented Sep 3, 2013

@heruan - Oh, I see what you're wanting - you want to use elements in the dropdown as links, but not adopt the default styling. Any reason you want a button rather than just an HREF? If it's to submit a form, you could use a JS onClick event rather than an actual submit.

@heruan
Copy link
Author

heruan commented Sep 4, 2013

@Joyrex yes, I can use anchors with JS listening on click events and this is what I'm doing right now. I'd just like to have the chance keep the HTML semantic with input tags to submit the form!

@raulgomis
Copy link

@mdo this feature has not been considerer, has it? I think it is not a great approach to have links to do actions (link submits) just because of the style.

@twbs twbs locked and limited conversation to collaborators Aug 1, 2014
@mdo
Copy link
Member

mdo commented Aug 1, 2014

@raulgomis Come v4 we'll have more classes for these things and you can mix buttons and inputs and links all you want.

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

No branches or pull requests

4 participants