components icon indicating copy to clipboard operation
components copied to clipboard

md-sidenav align="end" in child component causes horizontal scrolling

Open zpydee opened this issue 9 years ago • 10 comments

Bug, feature request, or proposal:

Bug

What is the expected behavior?

md-sidenav in child component shouldn't behave differently to md-sidenav in component with no child

What is the current behavior?

if you move md-sidenav with align="end" to a child component to the one housing md-sidenav-layout, horizontal scrolling is introduced when sidenav is closed.

What are the steps to reproduce?

THE FOLLOWING WORKS PERFECTLY:

<md-sidenav-layout fullscreen>
    <md-sidenav opened="true" align="end" #right style="width: 200px;">
        <button md-raised-buttton (click)="right.close()">CLOSE</button>
    </md-sidenav>
</md-sidenav-layout>

To check:

  1. Click close button
  2. Attempt to drag window horizontall. Nothing happens

NOW, WITH SIDENAV IN CHILD COMPONENT:

PARENT.HTML

<md-sidenav-layout fullscreen>
    <app-child></app-child>
</md-sidenav-layout>

CHILD.HTML

<md-sidenav opened="true" align="end" #right style="width: 200px;">
    <button md-raised-buttton (click)="right.close()">CLOSE</button>
</md-sidenav>

To simulate, repeat step above. Note that screen scrolls horizintally but the width of the md-sidenav.

screen shot 2016-12-11 at 3 35 02 pm

What is the use-case or motivation for changing an existing behavior?

i utilize multiple sidebar and want to encapsulate them as standalone components

Which versions of Angular, Material, OS, browsers are affected?

angular 2.2.3 material: alpha 11 os: osx 10.12.1 browser: chrome 55.0.2883.75 (64-bit) (but i get the same issue on any browser i've tried)

Is there anything else we should know?

nope, thanks.

zpydee avatar Dec 11 '16 13:12 zpydee

demo project for convenience

zpydee avatar Dec 11 '16 13:12 zpydee

Need to ping @hansl here, who is the author of the md-sidenav.

Right now the md-sidenav-container automatically detects the sidenav and the content by using ng-content (See here)

The problem here is, that the sidenav, which has been declared as standalone component, isn't detected by ng-content and now lives in the md-sidenav-content div.

I feel like it will be difficult to detect what's supposed to be the sidenav across different components

devversion avatar Dec 31 '16 15:12 devversion

thanks for looking. from a modularity perspective, i feel its important to be able to isolate interactions with the sidenav in its own child component otherwise the md-sidenav-container component becomes bloated when you want to implement multiple sidebars.

obviously i'm not familiar with the inner workings, but as a user it would be even better if there was no need to have a md-sidenav-container at all...

zpydee avatar Dec 31 '16 16:12 zpydee

I had the same problem and just got it working by removing the fullscreen attribute of the md-sidenav-container (md-sidenav-layout for you apparently)

oailloud avatar Mar 16 '17 10:03 oailloud

Had the same problem, got solved by giving the md-sidenav a position: fixed.

mumumilk avatar Aug 22 '17 13:08 mumumilk

The same problem, removing the fullscreen attribute doesn't help (how said @oailloud) But sulution is the position: fixed . Thanks @mumumilk

GarryBrown avatar Aug 23 '17 11:08 GarryBrown

@mumumilk thanks man worked perfect!!!

scriptsure avatar Oct 11 '17 02:10 scriptsure

Just a heads up that we kicked off a community voting process for your feature request. There are 20 days until the voting process ends.

Find more details about Angular's feature request process in our documentation.

angular-robot[bot] avatar Feb 01 '22 17:02 angular-robot[bot]

Thank you for submitting your feature request! Looks like during the polling process it didn't collect a sufficient number of votes to move to the next stage.

We want to keep Angular rich and ergonomic and at the same time be mindful about its scope and learning journey. If you think your request could live outside Angular's scope, we'd encourage you to collaborate with the community on publishing it as an open source package.

You can find more details about the feature request process in our documentation.

angular-robot[bot] avatar Feb 21 '22 15:02 angular-robot[bot]

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.