Skip to content

Fix multiple dropdowns in input group#28152

Closed
MartijnCuppens wants to merge 2 commits intov4-devfrom
v4-dev-mc-input-group-dropdowns
Closed

Fix multiple dropdowns in input group#28152
MartijnCuppens wants to merge 2 commits intov4-devfrom
v4-dev-mc-input-group-dropdowns

Conversation

@MartijnCuppens
Copy link
Copy Markdown
Member

@MartijnCuppens MartijnCuppens commented Jan 31, 2019

Comment thread scss/_input-group.scss
.btn {
&:not(:first-child) {
margin-left: -$input-border-width;
}
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could also have added .dropdown-menu here, but figured out this would save us a lot of selectors.

Comment thread scss/_input-group.scss
.input-group > .input-group-append:not(:last-child) > .btn,
.input-group > .input-group-append:not(:last-child) > .input-group-text,
.input-group > .input-group-append:last-child > .btn:not(:last-child):not(.dropdown-toggle),
.input-group > .input-group-append:last-child > .dropdown-toggle:nth-last-child(n + 3),
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(n + 3) stands for third last or more. This way the radius is removed only if the .dropdown-toggle is not the second last element ( and .dropdown-menu is the last). Couldn't combine this with L181, because complex selectors for :not() are not well supported.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feels like it'd break very easily—folks introduce custom markup in all the places we wouldn't expect. 😬

<div class="input-group-append">
<button class="btn btn-outline-secondary dropdown-toggle" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Dropdown</button>
<div class="dropdown-menu">
<div class="dropdown-menu dropdown-menu-right">
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added this because it just looks nicer if the dropdowns are aligned with the end of the button

@ysds
Copy link
Copy Markdown
Contributor

ysds commented Feb 1, 2019

Hi @MartijnCuppens #28150 would be not a CSS issue, because it has already been fixed in #25076. Please see #28150 (comment).

@MartijnCuppens
Copy link
Copy Markdown
Member Author

Closing this after feedback from @ysds and @mdo, thanks guys!

@MartijnCuppens MartijnCuppens deleted the v4-dev-mc-input-group-dropdowns branch February 12, 2019 17:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants