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

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

Closed
TylerDev6 opened this issue Jan 26, 2017 · 24 comments · Fixed by #183
Closed

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

TylerDev6 opened this issue Jan 26, 2017 · 24 comments · Fixed by #183
Assignees
Labels
Milestone

Comments

@TylerDev6
Copy link

TylerDev6 commented Jan 26, 2017

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.

@ThomasBurleson
Copy link
Contributor

Need a plunked plz

@TylerDev6
Copy link
Author

Do you have an existing plunkr I can start from?

@ThomasBurleson
Copy link
Contributor

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

@ThomasBurleson
Copy link
Contributor

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

@TylerDev6
Copy link
Author

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
Copy link
Author

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

@ThomasBurleson
Copy link
Contributor

ThomasBurleson commented Feb 6, 2017

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.

@TylerDev6
Copy link
Author

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

@TylerDev6
Copy link
Author

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.

@ThomasBurleson
Copy link
Contributor

@TylerDev6 - please file distinct issues separately.

@ThomasBurleson
Copy link
Contributor

ThomasBurleson commented Feb 9, 2017

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

@TylerDev6
Copy link
Author

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
Copy link
Author

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

@ThomasBurleson
Copy link
Contributor

Reopening as valid issue. Thx @TylerDev6

@ThomasBurleson ThomasBurleson reopened this Feb 9, 2017
@ThomasBurleson ThomasBurleson modified the milestones: v2.0.0-rc.0, v2.0.0-beta.5 Feb 9, 2017
@ThomasBurleson ThomasBurleson changed the title IE 11: Defaults to first matched query Wrong layout on initial page load with qualifiying overlapping breakpoints. Feb 9, 2017
@TylerDev6
Copy link
Author

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

@ThomasBurleson ThomasBurleson changed the title Wrong layout on initial page load with qualifiying overlapping breakpoints. Wrong layout with fxFlex="auto" and qualifying overlapping breakpoints. Feb 14, 2017
ThomasBurleson added a commit that referenced this issue Feb 14, 2017
Layout changes from gt-sm will not restore default layout with auto

fixes #135.
ThomasBurleson added a commit that referenced this issue Feb 14, 2017
Layout changes from gt-sm will not restore default layout with auto

fixes #135.
ThomasBurleson added a commit that referenced this issue Feb 15, 2017
Layout changes from gt-sm will not restore default layout with auto

fixes #135.
ThomasBurleson added a commit that referenced this issue Feb 21, 2017
Layout changes from gt-sm will not restore default layout with auto

fixes #135.
ThomasBurleson added a commit that referenced this issue Feb 21, 2017
Layout changes from gt-sm will not restore default layout with auto

fixes #135.
mmalerba pushed a commit that referenced this issue Feb 21, 2017
Layout changes from gt-sm will not restore default layout with auto

fixes #135.
@ThomasBurleson
Copy link
Contributor

fix_135

Fixed with #183

@TylerDev6
Copy link
Author

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

@ThomasBurleson
Copy link
Contributor

@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 ThomasBurleson reopened this Mar 6, 2017
@TylerDev6
Copy link
Author

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.

@ThomasBurleson
Copy link
Contributor

@TylerDev6 - Thank you.. we will investigate.

@ThomasBurleson ThomasBurleson removed the has pr A PR has been created to address this issue label Mar 6, 2017
@TylerDev6
Copy link
Author

basically, <fxFlex="auto" fxFlex.gt-sm="33%" fxFlex.gt-md="50%" is choosing 33% even though gt-md qualifies.... only on initial page load.

@ThomasBurleson
Copy link
Contributor

@TylerDev6 - please file a separate issue for this ^.

karlhaas pushed a commit to karlhaas/flex-layout that referenced this issue May 3, 2017
…lar#183)

Layout changes from gt-sm will not restore default layout with auto

fixes angular#135.
@ThomasBurleson
Copy link
Contributor

Closing as fixed.

@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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants