Skip to content

dropdown-menu-right works only inside navbars #23553

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
EdnaldoNeimeg opened this issue Aug 18, 2017 · 13 comments
Closed

dropdown-menu-right works only inside navbars #23553

EdnaldoNeimeg opened this issue Aug 18, 2017 · 13 comments
Labels

Comments

@EdnaldoNeimeg
Copy link

dropdown-menu-right doesn't work with pure CSS if you put it outside navbars.

@Johann-S
Copy link
Member

Bug reports must include a live demo of the problem. Per our contributing guidelines, please create a reduced test case via JS Bin or CodePen and report back with your link, Bootstrap version, and specific browser and OS details.

@EdnaldoNeimeg
Copy link
Author

EdnaldoNeimeg commented Aug 18, 2017

I used this CDNs:

https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-beta/css/bootstrap.min.css

Here is the live example: https://codepen.io/Neimeg/pen/XaZVyd

@jipexu
Copy link
Contributor

jipexu commented Aug 18, 2017

hummm ...the dropdown-menu-right class seems not exist alone in the css ..?

so if you add this
.dropdown-menu-right {
right: 0;
left: auto;
}

in the code pen css it works ...

@Johann-S
Copy link
Member

Johann-S commented Aug 18, 2017

Dropdown now depends on Popper.js so the positioning is done by Popper.js that's why you didn't find the CSS.
Your CodePen don't include jQuery and Popper.js

@jipexu
Copy link
Contributor

jipexu commented Aug 18, 2017

it doesnt work with too ...

@jipexu
Copy link
Contributor

jipexu commented Aug 18, 2017

Dropdown now depends on Popper.js so the positioning is done by Popper.js that's why you didn't find the CSS

so why we have those all classes (for each grid step)
.navbar-expand-sm .navbar-nav .dropdown-menu-right with

are they still usefull ??

@Johann-S
Copy link
Member

@Johann-S
Copy link
Member

Johann-S commented Aug 18, 2017

We made the choice to disable Popper.js for Dropdown in navbar because currently we don't have the need to use Popper.js

@jipexu
Copy link
Contributor

jipexu commented Aug 18, 2017

cool
so @EdnaldoNeimeg

dropdown-menu-right doesn't work with pure CSS if you put it outside navbars.

is true

@Johann-S
Copy link
Member

Yep that's true I'll reopen to let @mdo answer if we should re introduce this CSS class in this particular use case

@wojtask9
Copy link
Contributor

Just my thoughts.

Currently dropdown in BS i a little bit chaotic. There is data-placement attribute, .dropdown-menu-right class and another case for .navbar.

With current 'default' BS navbar implementation people can't use popper.js to position dropdown but there are cases when it is very helpful to use popper.js (kebab like menus, notification tips, etc)

I think the best solution is to add other placement from popper.js (top-left, bottom-left, top-right, bottom-right) and introduce placement static.
static turns off popper.js and everything relies on BS classes .dropup, .dropdown, .dropdown-margin-right.

Currently .navbar have a lot styles for dropdown so why not move this .dropdown-* classes to dropdown.scss? There is also PR that adds another dropdown class to .navbar #23520
So moving all dropdown-* classes to dropdown will make BS more flexible.

Of course docs should mention that in navbar dropdown should use 'static' placement.

@forrest-akin
Copy link

Bumping this as the bootstrap docs don't indicate that .dropdown-menu-right only works as a descendant to .navbar-nav. Had to dig around in the source to figure it out.

@Johann-S
Copy link
Member

It's written here: https://getbootstrap.com/docs/4.1/components/navbar/#supported-content

BTW there is no decision made here, so Dropdowns depend on Popper.js so if you want align your dropdown to the right, include Popper.js 👍

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

No branches or pull requests

5 participants