Skip to content
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 open triggers page scroll to bottom unexpectly #579

Closed
vuel opened this issue Mar 1, 2017 · 4 comments
Closed

sidenav open triggers page scroll to bottom unexpectly #579

vuel opened this issue Mar 1, 2017 · 4 comments

Comments

@vuel
Copy link

vuel commented Mar 1, 2017

See: https://codepen.io/wenris/pen/QpjPQE

This problem is caused by this code

this.$el.focus()

in src/mdSlidenav/mdSlidenav.vue line 45.

Simple remove that line and the following line this.$el.blur() will fix it, I don't know if I'm right?

@vuel vuel changed the title sidenav open triggers unexpected page scroll to bottom sidenav open triggers page scroll to bottom unexpectly Mar 1, 2017
@stramec
Copy link

stramec commented Mar 3, 2017

Hi @vuel - there was a similar discussion on the angular repo a while back around the point of $el.focus(), the workaround was pining the position of the sidenav to fixed.
angular/material#1891

I just dropped

.md-sidenav {
  position: fixed  !important;
}

into my sidenav component <style> block and all was good again.

@vuel
Copy link
Author

vuel commented Mar 4, 2017

Hi @stramec
Thank you for your reply, but adding the css doesn't work for me, now I cannot open the sidenav when clicking the menu button.
Help me: https://codepen.io/anon/pen/MpeoPL

@stramec
Copy link

stramec commented Mar 5, 2017

@vuel - just add md-fixed as a class to the md-sidenav component.
http://codepen.io/stramec/pen/vxKRYE

<md-sidenav class="md-left md-fixed" ref="sidenav">

I haven't looked why this is required, but it works.

@dennishu001
Copy link

dennishu001 commented Jun 28, 2017

Adding md-fixed does make the sidenav work again, however it doesn't solve the program of scrolling to bottom.

Update: putting sidenav at the top of the page above main contents seems to fix the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants