Skip to content
This repository has been archived by the owner on Jan 6, 2025. It is now read-only.

fxLayoutGap and fxFlexOrder #189

Closed
MihailoVasovic opened this issue Feb 18, 2017 · 9 comments
Closed

fxLayoutGap and fxFlexOrder #189

MihailoVasovic opened this issue Feb 18, 2017 · 9 comments
Assignees
Labels
bug P4 Low-priority issue that needs to be resolved
Milestone

Comments

@MihailoVasovic
Copy link

MihailoVasovic commented Feb 18, 2017

I have issue with fxLayoutGap when i set fxFlexOrder on a div element.As you can see, there is gap between item 1 and item 3, but no gap between item 3 and item 2 or item 4 and item 5. Am I doing something wrong or is this a bug?

@Component({
  selector: 'test-app',
  template: `
    
    <div class="container"
     fxLayout
     fxLayout.xs="column"
     fxLayoutAlign="center"
     fxLayoutGap="10px"
     fxLayoutGap.xs="0">
  <div class="item item-1" fxFlex="30%">Item 1</div>
  <div class="item item-2" fxFlex="30%" fxFlexOrder="3" >Item 2</div>
  <div class="item item-3" fxFlex="30%">Item 3</div>
</div>

screen shot 2017-02-20 at 5 14 40 pm

https://plnkr.co/edit/XwBm8pCOT3ZNYS6fCqo8?p=preview

@ThomasBurleson
Copy link
Contributor

ThomasBurleson commented Feb 20, 2017

fxLayoutGap applies a margin-right gap for fxLayout=='row'... for all items except the last item.

The issue you have identified is that the Item 3 is no longer the last time when fxFlexOrder is used. When flexOrder is used the DOM order does not change; instead only the FlexBox flow layout order changes...

fxLayoutGap has no current knowledge/awareness on this feature.

To resolve this issue, fxLayoutGap would need to sort the list of child DOM elements by their computed order styling. My current worries is that this edge-case fix would affect the performance within fxLayoutGap.

@ThomasBurleson ThomasBurleson added this to the v2.0.0-rc.1 milestone Feb 20, 2017
@ThomasBurleson ThomasBurleson self-assigned this Feb 20, 2017
@macjohnny
Copy link

@ThomasBurleson this problem could easily circumvented with the solution suggested in #165 (comment)

@ThomasBurleson ThomasBurleson modified the milestones: v2.0.0-rc.1, v2.0.0-rc.2 Mar 2, 2017
@ThomasBurleson ThomasBurleson modified the milestones: v2.0.0-rc.2, v2.0.0-rc.3 Mar 9, 2017
@fxck
Copy link

fxck commented Mar 17, 2017

@macjohnny I haven't really thoroughly read thru #165 but it seems like the same thing I suggested here #134 / #134 (comment) but I was kinda shut down / ignored

also cc @Jonatthu

@Jonatthu
Copy link

@fxck http://gridlex.devlint.fr/ Use this library for the flexbox grid system until this library know that this is essential and necessary, I will this library just for basic stuff but for more complex layouts like my example on plunkr http://plnkr.co/edit/Lu2xQIm0F5ONxaMBHIn0?p=preview using this does not worth it, too many steps with custom css and rules for achieve a simple grid system

@ThomasBurleson
Copy link
Contributor

ThomasBurleson commented Mar 17, 2017

@fxck - The team is intentionally cautious of adding solutions that are either not fully tested or not universal for all browsers.

@fxck
Copy link

fxck commented Mar 18, 2017

I think that this negative margin / positive padding has been well tested across multiple grid frameworks and works well in all browsers.

@boneskull
Copy link

boneskull commented May 29, 2017

I wouldn't call this an edge case. Here's an example of this type of usage on CSS Tricks.

Paraphrasing:

<style type="text/css">
  .wrapper { 
    display: flex;
    flex-flow: row;
  }
  
  .wrapper > * {
    padding: 10px; /* gap! */
  }
  
  .left-sidebar, .right-sidebar {
    flex: 1 100%;
  }

  .left-sidebar { 
    order: -1; /* could just give them all numbers, I suppose */
  }
  
  .main { 
    flex: 3 0;
  }

</style>

<div class="wrapper">
  <article>Bacon ipsum dolor amet ham landjaeger</article>
  <aside class="left-sidebar"><!-- links --></aside>
  <aside class="right-sidebar"><!-- annoying ads --></aside>
</div>

Re-implementing this using flex-layout:

<div fxLayout="row" fxLayoutGap="10px">
  <article>Bacon ipsum dolor amet ham landjaeger</article>
  <aside fxOrder="-1"><!-- links --></aside>
  <aside><!-- annoying ads --></aside>
</div>

The <article> tag has a style of margin-right: 10px, and the "links" sidebar has no such margin.

I have no preference for the solution, but wanted to establish WP:N. 😉

@ThomasBurleson ThomasBurleson added P3 Important issue that needs to be resolved P4 Low-priority issue that needs to be resolved and removed P3 Important issue that needs to be resolved labels Jun 22, 2017
@ThomasBurleson
Copy link
Contributor

Will not fix.

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 4, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug P4 Low-priority issue that needs to be resolved
Projects
None yet
Development

No branches or pull requests

6 participants