-
Notifications
You must be signed in to change notification settings - Fork 768
Overlapping breakpoints with ngClass doesn't apply on initial load, only works correctly on window resize #648
Comments
Ok so there's good news and bad news. The good news is that you're definitely not crazy, and this is inconsistent behavior. The bad news is that this is actually working exactly as its designed to work. Here's the logic: when there are competing breakpoints that are activated, the one with the widest range wins (this is documented on the Wiki, and means that lt-md > lt-sm, therefore blue). So on startup, all of the breakpoints become active at the same time and compete, and lt-md wins. BUT, when the window is resized, lt-sm is first deactivated, and then re-activated, meaning that the reactivation event triggered the green layout to appear. Is any of this correct? Honestly, I have a hard time knowing. I am very open to discussion on this, because it is a glaring inconsistency with how we treat breakpoints. |
Discussed with @ThomasBurleson and we're going to update the ordering algorithm to fix this issue. Hopefully it will get in by the next release. |
We're going to target this for the next beta round, which should land in a couple weeks. |
Use breakpoint priority as the only sorting/scanning mechanism; used to ensure correct MediaChange event notifications. * prioritize breakpoints: non-overlaps hightest, lt- lowest * consistently sort breakpoints ascending by priority * highest priority === smallest range * remove hackery with reverse(), etc. * memoize BreakPointRegistry findBy lookups * fix MatchMedia::observe() to support lazy breakpoint registration * fix fragile logic in MediaMarshaller * fix breakpoint registration usage * clarify update/clear builder function callbacks * fix MediaObserver breakpoint registration usage Fixes #648, Fixes #426
Use breakpoint priority as the only sorting/scanning mechanism; used to ensure correct MediaChange event notifications. * prioritize breakpoints: non-overlaps hightest, lt- lowest * consistently sort breakpoints ascending by priority * highest priority === smallest range * remove hackery with reverse(), etc. * memoize BreakPointRegistry findBy lookups * fix MatchMedia::observe() to support lazy breakpoint registration * fix fragile logic in MediaMarshaller * fix breakpoint registration usage * clarify update/clear builder function callbacks * fix MediaObserver breakpoint registration usage Fixes #648, Fixes #426
Use breakpoint priority as the only sorting/scanning mechanism; used to ensure correct MediaChange event notifications. * prioritize breakpoints: non-overlaps hightest, lt- lowest * consistently sort breakpoints ascending by priority * highest priority === smallest range * remove hackery with reverse(), etc. * memoize BreakPointRegistry findBy lookups * fix MatchMedia::observe() to support lazy breakpoint registration * fix fragile logic in MediaMarshaller * fix breakpoint registration usage * clarify update/clear builder function callbacks * fix MediaObserver breakpoint registration usage Fixes #648, Fixes #426
Use breakpoint priority as the only sorting/scanning mechanism; used to ensure correct MediaChange event notifications. * prioritize breakpoints: non-overlaps hightest, lt- lowest * consistently sort breakpoints ascending by priority * highest priority === smallest range * remove hackery with reverse(), etc. * memoize BreakPointRegistry findBy lookups * fix MatchMedia::observe() to support lazy breakpoint registration * fix fragile logic in MediaMarshaller * fix breakpoint registration usage * clarify update/clear builder function callbacks * fix MediaObserver breakpoint registration usage Fixes #648, Fixes #426
Use breakpoint priority as the only sorting/scanning mechanism; used to ensure correct MediaChange event notifications. * prioritize breakpoints: non-overlaps hightest, lt- lowest * consistently sort breakpoints ascending by priority * highest priority === smallest range * remove hackery with reverse(), etc. * memoize BreakPointRegistry findBy lookups * fix MatchMedia::observe() to support lazy breakpoint registration * fix fragile logic in MediaMarshaller * fix breakpoint registration usage * clarify update/clear builder function callbacks * fix MediaObserver breakpoint registration usage Fixes #648, Fixes #426
Use breakpoint priority as the only sorting/scanning mechanism; used to ensure correct MediaChange event notifications. * prioritize breakpoints: non-overlaps hightest, lt- lowest * consistently sort breakpoints ascending by priority * highest priority === smallest range * remove hackery with reverse(), etc. * memoize BreakPointRegistry findBy lookups * fix MatchMedia::observe() to support lazy breakpoint registration * fix fragile logic in MediaMarshaller * fix breakpoint registration usage * clarify update/clear builder function callbacks * fix MediaObserver breakpoint registration usage Fixes #648, Fixes #426
Use breakpoint priority as the only sorting/scanning mechanism; used to ensure correct MediaChange event notifications. * prioritize breakpoints: non-overlaps hightest, lt- lowest * consistently sort breakpoints ascending by priority * highest priority === smallest range * remove hackery with reverse(), etc. * memoize BreakPointRegistry findBy lookups * fix MatchMedia::observe() to support lazy breakpoint registration * fix fragile logic in MediaMarshaller * fix breakpoint registration usage * clarify update/clear builder function callbacks * fix MediaObserver breakpoint registration usage Fixes #648, Fixes #426
Use breakpoint priority as the only sorting/scanning mechanism; used to ensure correct MediaChange event notifications. * prioritize breakpoints: non-overlaps hightest, lt- lowest * consistently sort breakpoints ascending by priority * highest priority === smallest range * remove hackery with reverse(), etc. * memoize BreakPointRegistry findBy lookups * fix MatchMedia::observe() to support lazy breakpoint registration * fix fragile logic in MediaMarshaller * fix breakpoint registration usage * clarify update/clear builder function callbacks * fix MediaObserver breakpoint registration usage Fixes #648, Fixes #426
Use breakpoint priority as the only sorting/scanning mechanism; used to ensure correct MediaChange event notifications. * prioritize breakpoints: non-overlaps hightest, lt- lowest * consistently sort breakpoints ascending by priority * highest priority === smallest range * remove hackery with reverse(), etc. * memoize BreakPointRegistry findBy lookups * fix MatchMedia::observe() to support lazy breakpoint registration * fix fragile logic in MediaMarshaller * fix breakpoint registration usage * clarify update/clear builder function callbacks * fix MediaObserver breakpoint registration usage * cleanup tests: excessive use of `async()`. Fixes #648, Fixes #426.
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Bug, feature request, or proposal:
Bug
What is the expected behavior?
if I have overlapping breakpoints on a div, the nearest breakpoint is applied on initial load.
What is the current behavior?
The wrong breakpoint is applied on initial load, but is correct after resizing the window to another breakpoint and returning
What are the steps to reproduce?
https://stackblitz.com/edit/angular-flex-layout-seed-i45rb6
What is the use-case or motivation for changing an existing behavior?
The class that applies on load should be the correct class
Which versions of Angular, Material, OS, TypeScript, browsers are affected?
"@angular/core": "5.2.7"
"@angular/flex-layout": "5.0.0-beta.13"
"@angular/material": "5.2.3"
Chrome 64
Is there anything else we should know?
The text was updated successfully, but these errors were encountered: