question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`flex-direction: row; box-sizing: border-box; display: flex;` added automatically

See original GitHub issue

I am seeing flex-direction: row; box-sizing: border-box; display: flex;added on my component that is rendered in the router-outlet.

My app.component.html looks like

<pro-header *ngIf="!headless"></pro-header>
<router-outlet></router-outlet>
<pro-footer *ngIf="!headless"></pro-footer>

The router-outlet will render a component which I give a class fxFlex via

@HostBinding( 'class.fxFlex') true;

so it is flexed. However, when the components root DIV uses fxLayout column WITH an fxFlex, like

<div fxLayout="column" fxLayoutAlign="center center" fxFlex>

it automatically adds flex-direction row to its parent. The rendered html will be like

<pro-header *ngIf="!headless"></pro-header>
<router-outlet></router-outlet>
<pro-securing style="flex-direction: row; box-sizing: border-box; display: flex;">
....
</pro-securing>
<pro-footer *ngIf="!headless"></pro-footer>

This row layout on the pro-securing component creates the side effect that when the footer becomes large, it pushes the pro-securing into the header. It doesn’t allow a scrollbar.

I find this a bit strange behaviour. I am looking for a header, content (can expand) and sticky footer. Scroll bar should automatically engage when content is larger then header+content+footer.

Any thoughts?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
mattiLeBlanccommented, Nov 12, 2017

@CaerusKaru Thanks for answering. I can’t overwrite the parent since that is a component that is loaded by the router. I can’t add a fxLayout via hostbinding to the component annotation, since it is not compiled by angular. If I wrap my component with a div, then I think that Div has the same problem that it is not stretching the body.

I am just experiencing a little bit of a different behaviour setting up my sticky footer with the new flex layout and Angular 4 compared to Angular 1.6 and the flexlayout version from Material Design.

2reactions
rosslaverycommented, Nov 13, 2017

This is the same as #263, and it was resolved in #365 .

The fix is to use the stylesheet of the routed component to set the correct flex layout you desire (row / column).

This way you do not need to depend on adding the fxLayout attribute to a non-existent dom element, or using HostBinding etc.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why do images automatically fit in a container with flex ...
In flex-direction: row there is no such constraint, and the image is free to overflow the container. The simple solution is to apply...
Read more >
flex-direction - CSS: Cascading Style Sheets - MDN Web Docs
The flex-direction CSS property sets how flex items are placed in the flex container defining the main axis and the direction (normal or ......
Read more >
4. Flexbox Examples - Flexbox in CSS [Book] - O'Reilly
With a margin: auto; the body is centered within the viewport, which is only noticeable once the viewport is wider than 75 rems....
Read more >
CSS box-sizing property - W3Schools
Well organized and easy to understand Web building tutorials with lots of examples of how to use HTML, CSS, JavaScript, SQL, PHP, Python,...
Read more >
Equal Columns With Flexbox: It's More Complicated Than You ...
Of course, flexbox also comes in with it's default flex-direction: row behavior which turns the flex items into columns, putting them right ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found