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 Input Group Issue #28150

Closed
seanbotha123 opened this issue Jan 31, 2019 · 4 comments
Closed

Dropdown Input Group Issue #28150

seanbotha123 opened this issue Jan 31, 2019 · 4 comments

Comments

@seanbotha123
Copy link

seanbotha123 commented Jan 31, 2019

Hi guys.

Looks like there is an issue when adding a dropdown button to an input group, and not having the dropdown as the last element, the border-radius' are not correct:

screenshot from 2019-01-31 07-21-54

Please see fiddle for reproduction: http://jsfiddle.net/nxqdgkas/6/

  • Operating system and version: Ubuntu 18.04.1 LTS
  • Browser and version: Chrome 70.0.3538.77

Thanks!

@ysds
Copy link
Member

ysds commented Feb 1, 2019

If you want to use a dropdown on the button that isn't at the last element of the input group, you can do it by using multiple .input-group-appends. I mentioned about this usage in #25075, but it isn't described in the documents.

Demo: https://codepen.io/anon/pen/wNJWeL

Why need multiple .input-group-append? A .dropdown-menu must be the last child of the wrapper (.dropdown, .btn-group or an element has position: relative). This mean the following code is incorrect:

<div class="input-group">
  <input type="text" class="form-control">
  <div class="input-group-append">
    <button class="btn btn-outline-secondary dropdown-toggle" type="button" data-toggle="dropdown">Dropdown</button>
    <!-- dropdown-menu must be at the last of the container. -->
    <div class="dropdown-menu">
      <a class="dropdown-item" href="#">Action</a>
      <a class="dropdown-item" href="#">Another action</a>
      <a class="dropdown-item" href="#">Something else here</a>
    </div>
    <button class="btn btn-outline-secondary" type="button">Button</button>
  </div>
</div>

So, you should use multiple .input-group-appends:

<div class="input-group">
  <input type="text" class="form-control">
  <div class="input-group-append">
    <button class="btn btn-outline-secondary dropdown-toggle" type="button" data-toggle="dropdown">Dropdown</button>
    <div class="dropdown-menu">
      <a class="dropdown-item" href="#">Action</a>
      <a class="dropdown-item" href="#">Another action</a>
      <a class="dropdown-item" href="#">Something else here</a>
    </div>
  </div>
  <div class="input-group-append">
    <button class="btn btn-outline-secondary" type="button">Button</button>
  </div>
</div>

@MartijnCuppens
Copy link
Member

@seanbotha123,

You could indeed go for the approach suggested by @ysds.

@XhmikosR
Copy link
Member

@ysds maybe we should add this to the docs on master/v4-dev?

@ysds
Copy link
Member

ysds commented May 13, 2020

yep it is better for v4. But no need for v5 because #29885 made allow multiple dropdown menus in a single parent.

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

No branches or pull requests

4 participants