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

ngbDropdownMenu wrong position on small device in navbar #3030

Closed
mebibou opened this issue Feb 18, 2019 · 2 comments · Fixed by #3098
Closed

ngbDropdownMenu wrong position on small device in navbar #3030

mebibou opened this issue Feb 18, 2019 · 2 comments · Fixed by #3098

Comments

@mebibou
Copy link

mebibou commented Feb 18, 2019

Bug description:

When using a ngbDropdownMenu inside a navbar, opening the menu on a large device will make it render as position: absolute and will display below the opening button. But when reducing the screen and the dropdown should appear in the hamburger menu, when opening it is still displayed using position: absolute which makes the menu look weird (not taking the full width).
Note: this issue does NOT happen on 4.0.2 but does on 4.0.3. On 4.0.2 the position is not overridden by the library and it works. 4.0.3 is somehow adding position: absolute which is completely unnecessary and breaks the layout

Link to minimally-working StackBlitz that reproduces the issue:

https://stackblitz.com/edit/angular-gwm69f

Versions of Angular, ng-bootstrap and Bootstrap:

Angular: 7.0.0

ng-bootstrap: 4.0.3

Bootstrap: 4.2.0

@ghost
Copy link

ghost commented Feb 20, 2019

In Bootstrap Dropdown JS adds position and transform properties to .dropdown-menu. But when Dropdown is in a Navbar, it does not add anything.

image

image

See https://github.com/twbs/bootstrap/blob/master/js/src/dropdown.js#L147 they do not use Popper.js when Dropdown is in Navbar. ng-bootstrap should do the same.

@ahmadmu
Copy link

ahmadmu commented Mar 18, 2019

I'm not sure it's related, but I'm currently having an issue where in dev mode the ngbDropdownMenu is positioned using top: 38px, and in prod mode it's positioned using transform: translate(0, 38px), which is breaking my animations in production. Does someone know what might be the cause?

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

Successfully merging a pull request may close this issue.

3 participants