Skip to content

(sidenav) elements with position: fixed inside md-sidenav-layout #998

Closed

Description

@fxck

Because of transform: translate3d(0, 0, 0) on md-sidenav-layout any element with position: fixed inside it will act as if it had position: absolute or static instead. It's an expected behaviour, but it's annoying nevertheless.

Could we either remove that transform from md-sidenav-layout(it's only there because of performance I suppose), or add more examples to Portal and mention it as a workaround in docs, since portal could probably solve this by basically putting the element that needs to be fixed next to the md-sidenav-layout in the dom tree.

cc @hansl @jelbourn

Activity

  1. changed the title [-]fixed elements inside `md-sidenav-layout`[/-] [+](sidenav) fixed elements inside `md-sidenav-layout`[/+] on Aug 11, 2016
  2. changed the title [-](sidenav) fixed elements inside `md-sidenav-layout`[/-] [+](sidenav) elements with `position: fixed` inside `md-sidenav-layout`[/+] on Aug 11, 2016
  3. fxck commented on Sep 1, 2016

    @fxck
    ContributorAuthor

    https://gist.github.com/fxck/b668f7fec77d7b28d8c7ce6b706601f7

    here's a component that takes whatever is inside it and puts it to the body using material2 overlay

  4. fxck commented on Oct 5, 2016

    @fxck
    ContributorAuthor

    @jelbourn this is still a thing, can you label it please?

  5. jelbourn commented on Oct 5, 2016

    @jelbourn
    Contributor

    We need to discuss whether we consider this a bug or not.

  6. cortopy commented on Nov 4, 2016

    @cortopy

    In my opinion this is a bug insofar as it is the equivalent of putting a ban on fixed elements. I am now trying to create a fab button on the bottom right corner of the screen. Because of this issue I'm unable to do so unless I use solution provided by @fxck

  7. bergben commented on Nov 18, 2016

    @bergben

    Is the workaround from @fxck still working?
    I am getting EXCEPTION: Must provide a portal to attach...

  8. mmalerba commented on Nov 18, 2016

    @mmalerba
    Contributor

    I recommend just absolutely positioning the fab outside the scrollable region: http://plnkr.co/edit/VItn3Y2AaTzpzIykTTyH?p=preview

  9. cortopy commented on Nov 18, 2016

    @cortopy

    that's clever @mmalerba but it wouldn't work in my case. My button is inside a router outlet as the fab is not always needed. Your solution would work great for cases where fixed elements should be visible in every view though.

    Also, it would mean a lot of boilerplate to pass events to other components within the scrollable area

  10. cortopy commented on Nov 18, 2016

    @cortopy

    @bergben it is. I'm using material alpha 10 and it still works. It took me a bit to get it working though. Could you post what you have?

  11. bergben commented on Nov 18, 2016

    @bergben

    @cortopy
    It was kinda late yesterday, the problem was that I simply forgot to import the Directive as well 😄
    Got some other problem now though that the sidebar is not opening / visible / whatever...
    What I got now is this:

    <md-sidenav-layout [ngClass]="{'administration' : isLoggedIn}">
        <md-sidenav #sideNav mode="push" [hidden]="!isLoggedIn" opened="true">
            <noe-admin-sidenav>
            </noe-admin-sidenav>
        </md-sidenav>
        <fnls-displacer [sideNav]="sideNav">
                <noe-admin-topnav [sideNav]="sideNav" *ngIf="isLoggedIn">
                </noe-admin-topnav>
                <div class="content-wrapper">
                    <router-outlet></router-outlet>
                    <noe-footer></noe-footer>
                </div
        </fnls-displacer>
    </md-sidenav-layout>

    How exactly do I have to wrap the content with the displacer to get it to work?
    I also had to add this css to make the fixed content work:

    .md-overlay-pane{
        width:100%;
    }
    .md-overlay-container{
        position:absolute !important;
    }
  12. bergben commented on Nov 22, 2016

    @bergben

    Still couldn't resolve this. Seems like this wasn't a problem with the angular 1 version of the sidenav...
    Problem is, I don't only have one button that is fixed but the whole content is fixed for a certain time as I am using https://github.com/bergben/ng2-scrollimate to apply animations on the fly during scroll. So if I displace that all then there is nothing left anymore in md-sidenav-content and the sidenav itself doesn't work anymore...

  13. mmalerba commented on Nov 22, 2016

    @mmalerba
    Contributor

    #1966 adds a sidenav with fab example

  14. 27 remaining items

  15. WaterBleu commented on Sep 1, 2017

    @WaterBleu

    Im surprised we still have to do workaround at this point.
    this is like a year old bug

  16. CDDelta commented on Sep 1, 2017

    @CDDelta
  17. WaterBleu commented on Sep 1, 2017

    @WaterBleu

    @CDDelta nice! now just have to wait for the approval

  18. MatthewS2077 commented on Sep 5, 2017

    @MatthewS2077

    @CDDelta Excellent!

  19. mackelito commented on Sep 5, 2017

    @mackelito

    aaaah maaaaan.. just I did this like 3 weeks ago! 😆
    But still.. Great work 👊 😄

  20. karser commented on Sep 19, 2017

    @karser

    Great that it'll be fixed soon.
    Meanwhile after updating to 2.0.0-beta.10:

    .mat-sidenav-content,
    .mat-sidenav-container,
    .mat-drawer-content {
        transform: none !important;
    }
    
  21. sijithc40 commented on Oct 9, 2017

    @sijithc40

    I given this
    .mat-sidenav-content,
    .mat-sidenav-container,
    .mat-drawer-content {
    transform: none !important;
    }

    But side-nav "push" is not working now

  22. mina-skunk commented on Oct 9, 2017

    @mina-skunk
    Contributor

    @sijithc40 It won't because "push" mode uses transform.

  23. Sangeethaself commented on Nov 20, 2017

    @Sangeethaself

    Material design light with version v1.0.1

    After long searching and trying , problem solved by following code

    .mat-sidenav-container,
    md-sidenav-container div[style],
    .mat-sidenav-content{
    transform: none !important;
    -webkit-transform: none !important;
    }

  24. rahulasharm commented on Nov 28, 2017

    @rahulasharm

    I am using angular 2, so what should I do for this issue.....

  25. cybergaala commented on Mar 21, 2018

    @cybergaala

    Simply define width margin at mat-sidenav-content in styles.css file:

    mat-sidenav-content {
        width: 100vw;
    }
    
  26. angular-automatic-lock-bot commented on Sep 8, 2019

    @angular-automatic-lock-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.

  27. locked and limited conversation to collaborators on Sep 8, 2019
  28. added
    needs: discussion
    on Mar 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

needs: discussion

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions