Skip to content

Full support for Dropdown alignment options #26938

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

Closed
wants to merge 2 commits into from
Closed

Full support for Dropdown alignment options #26938

wants to merge 2 commits into from

Conversation

vepanimas
Copy link

@vepanimas vepanimas commented Jul 21, 2018

There are a lot of issues related to incomplete dropdown alignment support. In this PR I added support for all PopperJS placement options.

Two new classes were introduced: .dropdown-menu-center (for all directions) and .dropdown-menu-bottom (only for dropleft and dropright).

I am open to discussion, feel free to comment.

@Johann-S
Copy link
Member

It seems very nice, can you provide a CodePen to show us what you did ?

Copy link
Member

@Johann-S Johann-S left a comment

Choose a reason for hiding this comment

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

Please add unit tests

@vepanimas
Copy link
Author

Thx for the review! Here you can see an example https://r4j6xr2x0m.codesandbox.io/, the source code is here https://codesandbox.io/s/r4j6xr2x0m. And of course I'll add unit tests, I just need some time.

@vepanimas
Copy link
Author

@Johann-S, done!

Copy link
Member

@Johann-S Johann-S left a comment

Choose a reason for hiding this comment

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

LGTM ! Thanks @vepanimas !

Before merging that I need a review from @andresgalante or @mdo about your SCSS code 👍

And if it's fine I think we'll merge that in our next major release (4.2)

BTW it'll partially fixed #22962

@Johann-S Johann-S requested review from mdo and andresgalante July 22, 2018 08:39
Copy link
Collaborator

@andresgalante andresgalante left a comment

Choose a reason for hiding this comment

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

@vepanimas thanks a lot for you contribution! 👍The code is sound

@Johann-S the position of the menu gets overwritten by popper, the transforms and positions we have in our code base are a nice fallback in case the UI is loaded without JS or popper is not present.

@@ -595,7 +595,9 @@ Add `.disabled` to items in the dropdown to **style them as disabled**.

## Menu alignment

By default, a dropdown menu is automatically positioned 100% from the top and along the left side of its parent. Add `.dropdown-menu-right` to a `.dropdown-menu` to right align the dropdown menu.
By default, a dropdown menu is automatically positioned 100% from the top and along the left side of its parent.
When positioned horizontally add `.dropdown-menu-right` to a `.dropdown-menu` to right align the menu or `.dropdown-menu-center` to center.
Copy link
Collaborator

Choose a reason for hiding this comment

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

@mdo This is a bit hard to understand, I'd rewrite it as:

Apply .dropdown-menu-right or .dropdown-menu-center as a modifier to .dropdown-menu to right or center align the menu on a dropdown or dropup. And apply .dropdown-menu-bottom or .dropdown-menu-center as a modifier to .dropdown-menu to bottom or center align the menu on a dropright or dropleft.

What do you think?

Copy link
Author

Choose a reason for hiding this comment

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

I tried as hard as I could, but I'm not a native speaker =)

Copy link
Collaborator

Choose a reason for hiding this comment

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

@vepanimas don't worry, me neither, that's why I am asking @mdo 😝

Copy link
Member

Choose a reason for hiding this comment

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

Maybe @XhmikosR can help us too 😄 or @patrickhlauke

Copy link
Member

Choose a reason for hiding this comment

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

@mdo: can you chime in here? Otherwise this can be merged AFAIK.

@XhmikosR
Copy link
Member

Actually unit tests fail here.

@XhmikosR
Copy link
Member

Might be something with the conflicts, @Johann-S have a look when you can :)

@Johann-S
Copy link
Member

Maybe @vepanimas can fix the conflict ?

@vepanimas
Copy link
Author

@Johann-S , I'll look into it tomorrow.

@XhmikosR
Copy link
Member

Ping @vepanimas

@XhmikosR
Copy link
Member

XhmikosR commented Nov 4, 2018

Closing due to lack of response. You can comment here and we can re-open it if you decide to resume working on the requested changes.

@XhmikosR XhmikosR closed this Nov 4, 2018
@k-funk
Copy link

k-funk commented Jun 20, 2019

I too, would like to see this feature.

@XhmikosR XhmikosR reopened this Jun 21, 2019
@XhmikosR XhmikosR changed the base branch from v4-dev to master June 21, 2019 07:21
@XhmikosR
Copy link
Member

Not sure this PR can be merged so @k-func you're welcome to submit a new proper PR with unit tests.

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

Successfully merging this pull request may close these issues.

5 participants