-
Notifications
You must be signed in to change notification settings - Fork 6.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[MdSidenav] - Sidenav Resizing Regression #6743
Comments
…opening sometimes at the beggining possible issue would be angular/components#6743
* chore(): upgrade to material/[email protected] * chore(): update rollup script with cdk dependencies * fix(): fix breaking changes from cdk imports and interface modifications in material * feat(): rename mat-sidenav- classes to mat-drawer- and replace align input with position input * fix(steps): fix demo to start in vertical mode * chore(): rename md-line with mdLine * chore(): rename md-tab-label to mdTabLabel * chore(): rename md-card-avatar to mdCardAvatar * chore(): rename md-input-container to md-form-field and its classes * chore(): rename md-ripple to mdRipple * chore(): rename md-list-icon and md-list-avatar to mdListIcon and mdListAvatar * chore(): bump to [email protected] since its a requirement for angular/material now * chore(): update platform package.json's with bumps * fix(chips): md-basic-chip behaves diff now so click on chip was not working * fix(data-table): fix color of pseudo checkboxes in data-table * chore(paging): set fixed 30px in input since it has 200px by default in the paging demo * fix(paging): fix padding on md-selects used in td-paging-bar * chore(dynamic-forms): use flex row to stetch inputs/textareas * chore(dynamic-forms): update slider label using new classes * fix(layout-docs): workaround for now since MdSidenav has issues when opening sometimes at the beggining possible issue would be angular/components#6743 * feat(chips): make demo be OnPush change detection * docs(paging): updated 'md-input-container' to 'md-form-field'
+1. Same issue I have after upgrading to 2.0.0-beta.10 |
Same issue after upgrading from 2.0.0-beta.8 to 2.0.0-beta.10 My workarround : app.component.html
app.component.ts
|
that is exactly what i did @sbeaufort. It creates a small animation at the first page load but its ok |
I have the exact same issue. |
Here is my solution:
TS
|
@ghwyf Thank you very much! This workaround also worked for me. |
Same issue for me upgrading to 2.0.0-beta.10. |
Closing as duplicate of #1130 |
Join the responses of @angularexample in #1130 and @ghwyf here, works for me. |
@josephperrott I think the issues are about different things. The one you referenced is about opening and closing the sidenav automatically when viewport width changes. This one is about being able to resize the sidenav width while keeping it open. Before the last update this worked with no problem. Right now, the main content is not being resized when the sidebar width is resized. Some people have shared workarounds for this, but I think it would be nice if Angular Material would support this use case which is quite popular in places like firebase.
|
Reopening, sorry I misunderstood a bit there. |
It would be really helpful to give a guide on this. Are we going to do this with animations? Will there be a function on the sidenav (like sidenav.resize(width))? I am on the material2-builds and use the new fixedInViewport, which is great. But when I animate the sidenav from 220px to 75px the main content section does not adjust (as it used to before). Any comments as to what we will expect here? |
Same issue here. |
After a while, I was forced to come back to 2.0.0-beta.8 when sidenav works perfect. |
I would like to know if material team thinks this has to be fixed. If not, I will apply a workaround and stop waiting for a fix. Thanks a lot! |
Same problem here after upgrading to 2.0.0-beta.10 . The fix from @ghwyf doesn't work for me with angular 4.4.4 |
Here's my temporary workaround to fix it: <md-sidenav-container #sideNavContainer>
<md-sidenav #sideNav align="start" mode="{{navMode}}" opened="true"
[@sideNavAnim] (@sideNavAnim.done)="onSideNavAnimDone($event)">
<!-- sidenav content -->
</md-sidenav>
<!-- primary content -->
<router-outlet *ngIf="sideNavAnimFinished"></router-outlet>
</md-sidenav-container> export class MyComponent {
navMode = 'side';
sideNavAnimFinished = false;
...
onSideNavAnimDone(event) {
this.sideNavAnimFinished = true;
}
} |
the example mentioned by @sbeaufort does not work well when the component has ngAfterViewInit(): void {
const size = this.drawerState === 'open' ? 220 : 75;
setTimeout(() => {
this.sidenav.open();
this.cd.detectChanges();
}, size);
} |
@crisbeto is the resize function on a roadmap for sidenav? |
I was using @ghwyf workaround until beta.11 as well. What worked for me in beta.12 is the following:
|
@mpschaeuble this does not seem to work anymore: @mmalerba is there anything you guys can give us here? |
Adds the `autosize` input that allows users to opt-in to drawers that auto-resize, similarly to the behavior before angular#6189. The behavior is off by default, because it's unnecessary for most use cases and can cause performance issues. Fixes angular#6743.
Adds the `autosize` input that allows users to opt-in to drawers that auto-resize, similarly to the behavior before angular#6189. The behavior is off by default, because it's unnecessary for most use cases and can cause performance issues. Fixes angular#6743.
Adds the `autosize` input that allows users to opt-in to drawers that auto-resize, similarly to the behavior before angular#6189. The behavior is off by default, because it's unnecessary for most use cases and can cause performance issues. Fixes angular#6743.
Adds the `autosize` input that allows users to opt-in to drawers that auto-resize, similarly to the behavior before angular#6189. The behavior is off by default, because it's unnecessary for most use cases and can cause performance issues. Fixes angular#6743.
Adds the `autosize` input that allows users to opt-in to drawers that auto-resize, similarly to the behavior before angular#6189. The behavior is off by default, because it's unnecessary for most use cases and can cause performance issues. Fixes angular#6743.
@crisbeto thanks! Wonderful. How does one achieve the minification of the sidenav now? Animations? Is there an example? Can I toggle to a certain width? Thanks |
@axtho what these changes do is allow you to opt in to having the drawer container resize once per change detection cycle, rather than on open/close. |
@crisbeto so it is correct to assume that I would need to trigger change detection after running an animation when the component is on OnPush? |
You might not have to since the sidenav will check inside |
Still happening in 6.4.7:
|
Yep still an issue in 6.4.7 |
Come on, wheres the fix...? |
Same. This is still an issue in 6.4.7 |
This solution is still a bit of a hack, but it's less of a hack than setTimeout...
|
this.sidenavContainer.autosize = true; worked for me... after mucking with it for an hour. :( |
I observed the same issue in 6.4.7, but only in certain cases:
Finally I identified the buildOptimizer cache as the culprit. After deleting |
@dereekb this issue should not be closed. |
Where did you put autoSize = true ? |
@MeghnathDas here is documentation of |
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/Regression from 2.0.0-beta.8.
Also a feature request for an API to allow triggering recalculations for the MdSidenavContainer/MdDrawerContainer, or being able to update _styles manually and having the view update..
What is the expected behavior?
In the previous release 2.0.0-beta.8 the sidenav resized when the window was resized.
I have a responsive sidenav that uses Angular flex-layout for showing/hiding responsive content in the sidenav when the view changes from md to lg and vice-versa.
What is the current behavior?
In 2.0.0-beta.10 this is no longer the case. The changes made in #6189 made the sidenav update only when the sidenav is opening/closing.
Since flex-layout's changes occur without having to call open() or close() on the sidenav, the width recalculation doesn't occur.
What are the steps to reproduce?
Put dynamic/responsive content within a sidenav that is configured with "side".
What is the use-case or motivation for changing an existing behavior?
Being able to dynamically call a refresh of the MdSidenav/MdDrawer or MdSidenavContainer/MdDrawerContainer.
Even better would be an accessor to allow manually setting the margin of the sidenav to allow for pre-computing the _style variable and updating it when needed.
Which versions of Angular, Material, OS, TypeScript, browsers are affected?
Angular 4.3.5
Angular Material 2.0.0-beta.10
Is there anything else we should know?
This is similar to #6583.
For right now I am using the following hack in my navigation directive to workaround whenever the ObservableMedia from angular flex-layout changes:
The text was updated successfully, but these errors were encountered: