Skip to content
This repository has been archived by the owner on Mar 13, 2018. It is now read-only.

Window scroll bar disappearing. #67

Open
ermish opened this issue Aug 21, 2015 · 4 comments
Open

Window scroll bar disappearing. #67

ermish opened this issue Aug 21, 2015 · 4 comments

Comments

@ermish
Copy link

ermish commented Aug 21, 2015

When opening a dropdown, the window scrollbar is disappearing.

The paper-dropdown-menu demo shows the issue.

@solomongracio
Copy link

+1

1 similar comment
@dhineshdhanapal
Copy link

+1

@SamMaier
Copy link

Can reproduce here: http://jsbin.com/qukawalura/edit?html,output - however demo no longer shows the issue.

@ianbitts
Copy link

I was able to create a hacky work-around that suits my needs. Perhaps it will help other as well.

In your css...

body {
     overflow: auto !important;
}
body.noscroll {
       position: fixed;
       overflow-y: scroll !important;
       width: 100%;
}

In your app.js...

window.addEventListener('paper-dropdown-open', function () {
      var body = document.querySelector('body');
      // If the window's scroll bar would be visible, add the noscroll class.
      if (body.scrollHeight > body.clientHeight) {
          body.classList.add('noscroll');
      }
  });
  window.addEventListener('paper-dropdown-close', function () {
      document.querySelector('body').classList.remove('noscroll');
  });

Essentially, the css prevents Polymer from hiding the scroll bars when the dropdown is opened. The javascript and .noscroll class prevent the screen from being scrolled when the dropdown is open, but keep the scrollbar visible.

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

No branches or pull requests

5 participants