-
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
(sidenav) elements with position: fixed
inside md-sidenav-layout
#998
Comments
md-sidenav-layout
md-sidenav-layout
md-sidenav-layout
position: fixed
inside md-sidenav-layout
https://gist.github.com/fxck/b668f7fec77d7b28d8c7ce6b706601f7 here's a component that takes whatever is inside it and puts it to the |
@jelbourn this is still a thing, can you label it please? |
We need to discuss whether we consider this a bug or not. |
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 |
Is the workaround from @fxck still working? |
I recommend just absolutely positioning the fab outside the scrollable region: http://plnkr.co/edit/VItn3Y2AaTzpzIykTTyH?p=preview |
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 |
@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? |
@cortopy <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? .md-overlay-pane{
width:100%;
}
.md-overlay-container{
position:absolute !important;
} |
Still couldn't resolve this. Seems like this wasn't a problem with the angular 1 version of the sidenav... |
#1966 adds a sidenav with fab example |
@mmalerba Having a scroll inside content rather than on body brings a lot problems with UX and with fixed elements(various cases when fixed element is actually overlaying the scrollbar, or regions that appear part of scrollable areas but are not, so you are scrolling on them and the page doesn't scroll), also there are potential problems / extra set up on phones for smooth scrolling required, potential double scrollbars... meh. All this because of an unnecessary Take my directive, name it something better, make it a structural directive for easier use and add it to the core. It just puts everything inside it in a Overlay, nothing more, doesn't break binding in any way. Problem solved. Usable on many other places. |
I do think separate scrolling areas should be the recommended solution for this. If I have a lot of content in my sidenav I probably want it to scroll independently from my content area. However I do think it currently requires a bit too much work to set up, I would like to make it easier if possible. I'm also not opposed to removing the translate3d if it really is superfluous (I need to investigate) so that people can use the fixed positioning solution if they prefer. @jelbourn Do you have any opinions on this? |
@mmalerba This solution only works if you have relatively simple fixed content, if you have it spanning over the whole page or stuff like that it just gets too complicated. What I find interesting though is that this problem didn't seem to come up in the Angular 1 version of the sidenav - as I was searching through the issues there. |
I am using angular 2 material design, pls give a solution base on angular 2 material design and not material 1 |
@bergben I'm not sure I understand your template. Simplifying a lot this is what I have in <md-sidenav-layout>
<md-sidenav #start mode="side">
<my-sidenav></my-sidenav>
</md-sidenav>
<router-outlet></router-outlet>
</md-sidenav-layout> And then in a template for a component that gets loaded by the router I have: <fnls-displacer>
<button></button>
</fnls-displacer> |
fab button not being fixed on button right position while scrolling
…On Nov 29, 2016 3:38 PM, "Juan J. Jimenez-Anca" ***@***.***> wrote:
@bergben <https://github.com/bergben> I'm not sure I understand your
template.
Simplifying a lot this is what I have in app.component.html:
<md-sidenav-layout>
<md-sidenav #start mode="side">
<my-sidenav></my-sidenav>
</md-sidenav>
<router-outlet></router-outlet>
</md-sidenav-layout>
And then in a template for a component that gets loaded by the router I
have:
<fnls-displacer>
<button></button>
</fnls-displacer>
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#998 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AKF9fMNi-a5ccvI1k6Ot40RvfZHCmcX8ks5rC_mzgaJpZM4JiD6w>
.
|
Yeah you got that right @cortopy there are no inputs on displacer itself, it's literally just "take whatever is inside me and append it to body". It doesn't break bindings or anything, so it's as if you were wrapping it in a div. What I think he's doing is wrapping the whole router-outlet inside it, which I'm not surprised at all that doesn't work. It's really intended for buttons/modals/whatever you need appended to body from inside the router outlet. cc @bergben |
I have the fab button inside a component and this component is being called
from router-outlet and the router-outlet is inside the side-nav-layout as u
have described. After doing every thing the fab scrolls while scrolling
data in the component which is not what I need.
On Nov 29, 2016 10:01 PM, "Aleš" <notifications@github.com> wrote:
Yeah you got that right @cortopy <https://github.com/cortopy> there are no
inputs on displacer itself, it's literally just "take whatever is inside me
and append it to body". It doesn't break bindings or anything, so it's as
if you were wrapping it in a div. What I think he's doing is wrapping the
whole router-outlet inside it, which I'm not surprised at all that doesn't
work. It's really intended for buttons/modals/whatever you need appended to
body from *inside* the router outlet.
cc @bergben <https://github.com/bergben>
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#998 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AKF9fBpBHTG8b78hNquET1i-TVcNbcKhks5rDFNMgaJpZM4JiD6w>
.
|
@johnl242 don't forget to style your button!! The displacer doesn't do anything in terms of styling or positioning. This is what I have bottom: 1rem
position: fixed
right: 1rem
transform: translateZ(0) |
@Defmetalhead removing the transition screws up the sidebar content animation when you toggle the menu. In my case using just
was all I needed to get the |
@radoslavpetranov I do not experience the issue with the sidebar animation, but you are correct in the fact that only "transform" needs to be overwritten. |
Just a note this is also causing change in behavior in other libraries as well. http://wijmo.com/topic/how-to-prevent-window-scroll-to-top-on-wijmo-flexgrid-click-event/ |
It is actually breaking bindings, a form submit If I manually submit through a |
I use a third party charting library in the content and the transform breaks all their mouseover tooltips in certain container structures.. It also causes full page flickers in IE 11 when their tooltips are active. Turning off the 3d transform fixes all these things. What does it do? Is it necessary? |
using transform will (on some devices) trigger to use hardware acceleration.. feels like a good incentive to keep it.. ? |
With the latest release the component @fxck built no longer works due to the TemplatePortal changes. Can we get an updated version as a patch until this is resolved. Also, just removing transforms via CSS no longer seems to be a valid work around. |
the transform fix still works for me but they changed the class names from .mat-sidenav-* to .mat-drawer-* so you probably have to update your css |
Yeah looks like I missed one of the .mat-drawer classes. Working now. Thanks! |
Im surprised we still have to do workaround at this point. |
@WaterBleu see #6712 |
@CDDelta nice! now just have to wait for the approval |
@CDDelta Excellent! |
aaaah maaaaan.. just I did this like 3 weeks ago! 😆 |
Great that it'll be fixed soon.
|
I given this But side-nav "push" is not working now |
@sijithc40 It won't because "push" mode uses |
Material design light with version v1.0.1 After long searching and trying , problem solved by following code .mat-sidenav-container, |
I am using angular 2, so what should I do for this issue..... |
Simply define width margin at mat-sidenav-content in styles.css file:
|
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. |
Because of
transform: translate3d(0, 0, 0)
onmd-sidenav-layout
any element withposition: fixed
inside it will act as if it hadposition: absolute
orstatic
instead. It's an expected behaviour, but it's annoying nevertheless.Could we either remove that
transform
frommd-sidenav-layout
(it's only there because of performance I suppose), or add more examples toPortal
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 themd-sidenav-layout
in the dom tree.cc @hansl @jelbourn
The text was updated successfully, but these errors were encountered: