1
votes

I am building a full-screen app with Polymer. Currently, I've defined my layout like this:

  <body unresolved class="fullbleed">
    <template is="dom-bind" id="app">
      <paper-scroll-header-panel fixed>
        <paper-toolbar>
          <div class="spacer title" style="margin-left:0px;">My App</div>        

          <paper-icon-button icon="search"></paper-icon-button>
          <paper-icon-button icon="more-vert"></paper-icon-button>
        </paper-toolbar>

        <paper-drawer-panel id="paperDrawerPanel"> 
          <div drawer>
            <my-nav flex></my-nav>            
          </div>       
          <div main class="content">
            <my-view></my-view>
          </div>
        </paper-drawer-panel>
      </paper-scroll-header-panel>      
    </template>
  </body>

The view in <div main class="content"> looks like this:

my-view.html

  <dom-module id="project-view">    
    <template>
      <neon-animated-pages class="flex" selected="[[selectedPageIndex]]" entry-animation="fade-in-animation" exit-animation="fade-out-animation">
        <!-- Page 1 -->
        <div>
          <paper-header-panel mode="seamed">
            <div class="paper-header">
              <paper-toolbar class="view-toolbar">
                <paper-icon-button icon="menu"></paper-icon-button>             
                <span class="flex"></span>      
                <paper-icon-button icon="menu"></paper-icon-button>             
              </paper-toolbar>              
            </div>

            <div class="content">
              <paper-material elevation="2">
                <h1>Welcome</h1>
                <p>
                   This will be a BIG text block that require scrolling. The toolbar should always be visible. The "paper" should scroll under the toolbar like a Google Doc
                </p>
              </paper-material>
            </div>
          </paper-header-panel>
        </div>

        <!-- Page 2 -->
        <div>
          <paper-material elevation="2">
            <p>Another page</p>
          </paper-material>
        </div>
      </neon-animated-pages>

      <script>
        Polymer({
          is: "my-view",
          ready: function() {
            this.selectedPageIndex = 0;
          }
        });
      </script>
    </template>
  </dom-module>

When I run this page, the content under the toolbar will not scroll. It stays fixed in position. I do not understand why. How do I create some paper under a toolbar so that it scrolls beneath the toolbar like Google Docs?

Update:

Main layout changed to:

  <paper-header-panel class="flex" style="background-color:lightcoral;">
    <paper-toolbar>
      <div class="spacer title" style="margin-left:0px;">My App</div>        

      <paper-icon-button icon="search"></paper-icon-button>
      <paper-icon-button icon="more-vert"></paper-icon-button>
    </paper-toolbar>

    <div class="flex content" style="background-color:lightsalmon;">
      <div class="horizontal layout">
        <div drawer>
          <my-nav flex></my-nav>            
        </div>       
        <div main class="content">
          <my-view></my-view>
        </div>
      </div>
    </div>
  </paper-header-panel>

The content scrolls. However, the content of the paper-drawer-panel does not fill the remaining area below the toolbar. I do not understand why. It's like the iron-flex-layout stuff isn't working. What am I doing wrong?

3
This would be considerably easier to troubleshoot for you if you could give us a jsfiddle or some other way to try the code live. - Dogs

3 Answers

0
votes

My guess is that it has something to do with the paper-drawer-panel being inside of the paper-scroll-header-panel element. On top of that likely being the culprit, you should consider that if you do have the paper-drawer-panel inside of the paper-scroll-header-panel, it will scroll with your content.

I would try either removing or moving the paper-drawer-panel to start with, and then adding it back in once you have the scrolling working.

0
votes

I'm not sure if this is already implemented, but this blog post might help you as it explicitly mentions the paper-toolbar together with flex layout :

https://blog.polymer-project.org/announcements/2015/12/01/deprecating-deep/

So you could try using mixins instead of the flex-class.

0
votes

Try to use paper-dialog-scrollable. All you have to do is set width and height of the scroll area. Works with static and dynamic content.