flex-layout icon indicating copy to clipboard operation
flex-layout copied to clipboard

Layout with fxFlex="auto" not restoring max-height values properly

Open TylerDev6 opened this issue 9 years ago • 24 comments

on page load scans breakpoint overlaps too aggressively [and matches the smallest instead of the largest matching].

<div fxFlex="auto" fxFlex.gt-xs="33%" fxFlex.gt-sm="50%"></div>

I'm using fxFlex with 3 breakpoints and IE seems to only pick the first one it passes:

on page load, in spite of gt-sm qualifying, it defaults to the gt-xs value. However if I manually re-size the browser it will correct itself. This happens in IE11 only.

TylerDev6 avatar Jan 26 '17 21:01 TylerDev6

Need a plunked plz

ThomasBurleson avatar Jan 26 '17 22:01 ThomasBurleson

Do you have an existing plunkr I can start from?

TylerDev6 avatar Jan 27 '17 13:01 TylerDev6

@TylerDev6 - please update with Beta.4 (from npm) and see if the problem persists.

ThomasBurleson avatar Jan 28 '17 21:01 ThomasBurleson

@TylerDev6 - Try this Starter Plunkr: https://plnkr.co/edit/h8hzyoEyqdCXmTBA7DfK?p=preview

ThomasBurleson avatar Jan 30 '17 02:01 ThomasBurleson

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

Thanks for the help. Here's a plunk showing the problem.... I noticed a few things:

  1. It is also reproducible in Chrome / Firefox.
  2. It didn't start happening until I added fxLayoutGap properties.

Essentially, on initial page load the widths are being set to 33-33-33, instead of 50-23.4-23.4. Manually resizing the window will correct it.

TylerDev6 avatar Jan 30 '17 14:01 TylerDev6

I am also noticing now that going from a % based fxFlex to fxFlex="auto" does not remove the % restriction.

TylerDev6 avatar Feb 06 '17 18:02 TylerDev6

If you are using the code from HEAD, you should see this:

https://github.com/angular/flex-layout/blob/master/src/lib/flexbox/api/flex.ts#L264

which means the applied inline style should be flex: 1 1 auto. If not, please file a separate issue.

ThomasBurleson avatar Feb 06 '17 18:02 ThomasBurleson

so I should check out @latest? I'm running beta.4 at the moment

TylerDev6 avatar Feb 06 '17 18:02 TylerDev6

and what's going is as follows:

fxFlex.gt-sm=33% will apply a max-width: 33% in addition to the flex 1 1 100% style..... fxFlex="auto" will switch to flex 1 1 auto, but the max-width: 33% remains.

TylerDev6 avatar Feb 06 '17 18:02 TylerDev6

@TylerDev6 - please file distinct issues separately.

ThomasBurleson avatar Feb 06 '17 18:02 ThomasBurleson

This is working well with the latest code in master: Plunkr Demo

-XS- screen shot 2017-02-09 at 2 08 12 pm

-SM- screen shot 2017-02-09 at 2 07 47 pm

-MD- screen shot 2017-02-09 at 2 07 23 pm

ThomasBurleson avatar Feb 09 '17 20:02 ThomasBurleson

I can still break your plunk.... expand to largest viewport, then refresh.... it's only on initial load of the page that it breaks.

TylerDev6 avatar Feb 09 '17 20:02 TylerDev6

and the "active media query" field in your plunk lists the wrong one. So I guess that's where the problem lies.

TylerDev6 avatar Feb 09 '17 20:02 TylerDev6

Reopening as valid issue. Thx @TylerDev6

ThomasBurleson avatar Feb 09 '17 20:02 ThomasBurleson

Cool. Thanks @ThomasBurleson for your work on this library. It's fantastic.

TylerDev6 avatar Feb 09 '17 20:02 TylerDev6

fix_135

Fixed with #183

ThomasBurleson avatar Feb 21 '17 23:02 ThomasBurleson

I moved to 2.0.0-rc.1 and can still reproduce this problem....

TylerDev6 avatar Mar 06 '17 18:03 TylerDev6

@TylerDev6 - When one or more mediaQueries activate (which may happen when the current viewport size is in the range of 1 or more mediaQuery ranges), the ObservableMedia will report each... and perhaps the UI only shows the last one to arrive.

Based on current code in HEAD, what specifically is the issue you are reporting ?

ThomasBurleson avatar Mar 06 '17 20:03 ThomasBurleson

So when testing with the Plunk, I see that the ObservableMedia is accurately reporting the correct media query now, however the UI is still displaying the first matching result.

TylerDev6 avatar Mar 06 '17 20:03 TylerDev6

@TylerDev6 - Thank you.. we will investigate.

ThomasBurleson avatar Mar 06 '17 21:03 ThomasBurleson