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

.container within navbar undoes ability to use flexbox positioning #21708

Closed
henwen opened this issue Jan 13, 2017 · 7 comments
Closed

.container within navbar undoes ability to use flexbox positioning #21708

henwen opened this issue Jan 13, 2017 · 7 comments
Labels

Comments

@henwen
Copy link

henwen commented Jan 13, 2017

A stated goal of the Alpha6 .navbar is the ability to use flexbox to position items within.

This works fine for elements that are immediate children of .navbar (the flex parent). However, when a .container is placed within .navbar (a common pattern), flexbox positioning is no longer an option because .container is not display: flex.

One could manually add d-flex but that seems unintuitive when display: flex is presented as the assumed display context for navbars.

@davidtmiller
Copy link

davidtmiller commented Jan 13, 2017

+1 I am seeing the same issue.

The left and right margins that are set to the container class are having some strange interaction with the navbar.

  • Mac OS 10.12.2
  • Chrome

Here is the issue in action:
v4-alpha getbootstrap com- iphone 6 plus 1

If you go into the inspector and disable margin-left: auto and margin-right: auto on the .container class then things go back to normal on mobile, but this isn't a fix because it messes up the alignment of the container on larger screens where the container width is less than the screen width.

Here's what it looks like on mobile with the margins disabled though:
v4-alpha getbootstrap com- iphone 6 plus 2

It looks like if you disable the auto margins at <576px then the problem is remedied, but I'm not sure if there would be other consequences of doing so.

UPDATE: Adding margin-left: 0 and margin-right: 0 at <576px to .container disables the ability to toggle the navbar. Exploring more fixes...

@henwen
Copy link
Author

henwen commented Jan 13, 2017

@davidtmiller I believe you're experiencing this issue, which also seems related to container being the only flex item within the navbar flex parent.

@davidtmiller
Copy link

@henwen Yep that's the one...thanks!

@davidtmiller
Copy link

Fixes in #21605

@pvdlg
Copy link
Contributor

pvdlg commented Jan 14, 2017

@davidtmiller, I think this is a different issue. What @henwen report is that .navbar is display: flex and allow to position its content with flex, while .container is not display: flex.

Is it your actual issue @henwen ?

Although, a .container within a .navbar is display: flex, but only at a breakpoint in which the navbar is expanded (i.e. no toggle button and all item visible). See _navbar.scss#L155.

Indeed, a .container within a .navbar is not display: flex when the menu is collapsible (nav-item non visible in the top bar, toggle button visible).

Is what you trying to achieve is to position with flex the content of the container when the navbar is collapsible ?

@henwen
Copy link
Author

henwen commented Jan 16, 2017

@vanduynslagerp yep, that's my actual issue, and it's the case regardless of whether the navbar is collapsible or not.

@mdo
Copy link
Member

mdo commented Jan 21, 2017

I believe the container issue was fixed with #21722.

@mdo mdo closed this as completed Jan 21, 2017
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