Skip to content

Fix incorrect responsive alignment of dropdown menu - #27873

Merged
XhmikosR merged 2 commits into
twbs:v4-devfrom
ysds:patch-2
Jan 7, 2019
Merged

XhmikosR merged 2 commits into
twbs:v4-devfrom
ysds:patch-2

Conversation

@ysds

@ysds ysds commented Dec 18, 2018

Copy link
Copy Markdown
Contributor

It is incorrect to define left and right within separate @media.

The following demo shows incorrect alignment. The dropdown menu should be right aligned when large screen.

demo: https://codepen.io/anon/pen/WLGjGz

To fix the priority problem, it must be defined at the same breakpoint like a text utility.

@each $breakpoint in map-keys($grid-breakpoints) {
@include media-breakpoint-up($breakpoint) {
$infix: breakpoint-infix($breakpoint, $grid-breakpoints);
.text#{$infix}-left { text-align: left !important; }
.text#{$infix}-right { text-align: right !important; }
.text#{$infix}-center { text-align: center !important; }
}
}

@ysds
ysds requested a review from a team as a code owner December 18, 2018 06:14

@MartijnCuppens MartijnCuppens left a comment

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 not only fixes the problem, but also combines multiple classes in a media query which saves some css. Thanks a lot, @ysds!

@mdo mdo mentioned this pull request Jan 7, 2019
@XhmikosR
XhmikosR merged commit 92cc5a7 into twbs:v4-dev Jan 7, 2019
@ysds
ysds deleted the patch-2 branch January 7, 2019 01:39
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.

4 participants