Giter VIP home page Giter VIP logo

paper-drawer-panel's Introduction

Published on NPM Build status Published on webcomponents.org

<paper-drawer-panel>

This element has been deprecated in favor of app-layout.

paper-drawer-panel contains a drawer panel and a main panel. The drawer and the main panel are side-by-side with drawer on the left. When the browser window size is smaller than the responsiveWidth, paper-drawer-panel changes to narrow layout. In narrow layout, the drawer will be stacked on top of the main panel. The drawer will slide in/out to hide/reveal the main panel.

Use the attribute drawer to indicate that the element is the drawer panel and main to indicate that the element is the main panel.

Example:

<paper-drawer-panel>
  <div slot="drawer"> Drawer panel... </div>
  <div slot="main"> Main panel... </div>
</paper-drawer-panel>

The drawer and the main panels are not scrollable. You can set CSS overflow property on the elements to make them scrollable or use paper-header-panel.

Example:

<paper-drawer-panel>
  <paper-header-panel slot="drawer">
    <paper-toolbar></paper-toolbar>
    <div> Drawer content... </div>
  </paper-header-panel>
  <paper-header-panel slot="main">
    <paper-toolbar></paper-toolbar>
    <div> Main content... </div>
  </paper-header-panel>
</paper-drawer-panel>

To position the drawer to the right, add right-drawer attribute.

<paper-drawer-panel right-drawer>
  <div slot="drawer"> Drawer panel... </div>
  <div slot="main"> Main panel... </div>
</paper-drawer-panel>

Styling

To change the main container:

paper-drawer-panel {
  --paper-drawer-panel-main-container: {
    background-color: gray;
  };
}

To change the drawer container when it's in the left side:

paper-drawer-panel {
  --paper-drawer-panel-left-drawer-container: {
    background-color: white;
  };
}

To change the drawer container when it's in the right side:

paper-drawer-panel {
  --paper-drawer-panel-right-drawer-container: {
    background-color: white;
  };
}

To customize the scrim:

paper-drawer-panel {
  --paper-drawer-panel-scrim: {
    background-color: red;
  };
}

The following custom properties and mixins are available for styling:

Custom property Description Default
--paper-drawer-panel-scrim-opacity Scrim opacity 1
--paper-drawer-panel-drawer-container Mixin applied to drawer container {}
--paper-drawer-panel-left-drawer-container Mixin applied to container when it's in the left side {}
--paper-drawer-panel-main-container Mixin applied to main container {}
--paper-drawer-panel-right-drawer-container Mixin applied to container when it's in the right side {}
--paper-drawer-panel-scrim Mixin applied to scrim {}

See: Documentation, Demo.

Usage

Installation

npm install --save @polymer/paper-drawer-panel

In an html file

<html>
  <head>
    <script type="module">
      import '@polymer/paper-drawer-panel/paper-drawer-panel.js';
    </script>
  </head>
  <body>
    <paper-drawer-panel>
      <div slot="drawer"> Drawer panel... </div>
      <div slot="main"> Main panel... </div>
    </paper-drawer-panel>
  </body>
</html>

In a Polymer 3 element

import {PolymerElement, html} from '@polymer/polymer';
import '@polymer/paper-drawer-panel/paper-drawer-panel.js';

class SampleElement extends PolymerElement {
  static get template() {
    return html`
      <paper-drawer-panel>
        <div slot="drawer"> Drawer panel... </div>
        <div slot="main"> Main panel... </div>
      </paper-drawer-panel>
    `;
  }
}
customElements.define('sample-element', SampleElement);

Contributing

If you want to send a PR to this element, here are the instructions for running the tests and demo locally:

Installation

git clone https://github.com/PolymerElements/paper-drawer-panel
cd paper-drawer-panel
npm install
npm install -g polymer-cli

Running the demo locally

polymer serve --npm
open http://127.0.0.1:<port>/demo/

Running the tests

polymer test --npm

paper-drawer-panel's People

Contributors

abarth avatar abdonrd avatar adalinesimonian avatar addyosmani avatar antonmoiseev avatar aomarks avatar bicknellr avatar blasten avatar cdata avatar chuckh avatar cpjobling avatar dfreedm avatar e111077 avatar ebidel avatar frankiefu avatar garlicnation avatar gronke avatar jakemac53 avatar jklein24 avatar keanulee avatar martinmoizard avatar notwaldorf avatar rictic avatar sorvell avatar ssorallen avatar t-soares avatar tedium-bot avatar tjsavage avatar tyriar avatar yyamoryk-google avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

paper-drawer-panel's Issues

Link with anchor target to the iframe

I have links in paper-header-panel drawer with anchor target to an iframe in paper-header-panel main.
The whole panel will be scrolled with the iframe, when a link is clicked.
It only happened in webkit browsers but not Firefox.

Drawer width is not flexible

According to the spec, the drawer panel width should be 100% minus the height of the action bar (56px), or 280px on mobile, and 320px on tablet.

Currently this needs to be worked around outside the element, because it only supports a fixed number via the drawerWidth property.

I came up with a simple CSS rule which can implement this (for mobile):

paper-drawer-panel #drawer {
  width: calc(100% - 56px) !important;
  max-width: 280px;
}

But this is a bit ugly, because I have to use !important to override the style attribute used inside the element, and also breaks the always-open mode on large screens.

drawer-panel toggle element does not hide in wide layout

The drawer-panel (v1.0.1) documentation states:
"An element that should toggle the drawer will automatically do so if it's given the paper-drawer-toggle attribute. Also this element will automatically be hidden in wide layout."

However, this behavior is not observed in both desktop and mobile. The toggle icon remains visible despite wide or narrow layouts.

here is the basic app layout with two menu items. I am serving this as part of a Ruby on Rails app; menu items invoke an Ajax request and the response is inserted into the #main-content.

  <body fullbleed layout unresolved vertical>
    <div class='page-container'>
      <paper-drawer-panel drawerWidth='200px' id='coreDrawerPanel'>
        <paper-header-panel drawer>
          <paper-toolbar>
            <div title>Menu</div>
          </paper-toolbar>
          <paper-menu attr-for-selected='hash' class='list' selected='home'>
            <paper-item hash='home'>
              <paper-icon-button icon='home'></paper-icon-button>
              <a onClick="jQuery.get( &#39;/&#39;, {}, null, &#39;script&#39; );return false;" href="javascript:void(0);">Dashboard</a>
            </paper-item>
            <paper-item hash='help'>
              <paper-icon-button icon='help'></paper-icon-button>
              <a onClick="jQuery.get( &#39;/home/help&#39;, {}, null, &#39;script&#39; );return false;" href="javascript:void(0);">Help</a>
            </paper-item>
          </paper-menu>
        </paper-header-panel>
        <paper-header-panel main>
          <paper-toolbar id='mainToolbar'>
            <paper-icon-button elevation='1' icon='menu' paper-drawer-toggle></paper-icon-button>
            <div title>Application Name</div>
          </paper-toolbar>
          <div class='content m-scene' id='main-content'>
                 <!--  *****************  any content gets dynamically inserted here ********************** -->
            <div class='container m-right-panel m-page scene_element scene_element--fadeinright'>
            </div>
          </div>
        </paper-header-panel>
      </paper-drawer-panel>
    </div>
  </body>
  <script>
    (function (document) {
      'use strict';

      // See https://github.com/Polymer/polymer/issues/1381
      // No polymer-ready event fire anymore
      window.addEventListener('WebComponentsReady', function() {
        document.querySelector('body').removeAttribute('unresolved');
      });

    })(document);
</script>

Environment

Desktop: Ubuntu 14.04 with Chrome Version 43.0.2357.124
Mobile: Nexus 7 2014 Android 5.1.1 build LMY47V with Chrome 43.0.2357.93 with Javascript v8 4.3.61.22
Polymer 1.0.3
paper-drawer-panel 1.0.1
jQuery 1.11.2
Ruby 2.2.1
Rails 4.2.1

all required iron & paper elements have been imported and verified using Chrome Developer's console (shown below in excruciating detail).

    <link rel="import" href="/assets/polymer/polymer-micro.html?body=1" data-turbolinks-track="true" />
    <link rel="import" href="/assets/polymer/polymer-mini.html?body=1" data-turbolinks-track="true" />
    <link rel="import" href="/assets/polymer/polymer.html?body=1" data-turbolinks-track="true" />
    <link rel="import" href="/assets/promise-polyfill/promise-polyfill-lite.html?body=1" data-turbolinks-track="true" />
    <link rel="import" href="/assets/iron-ajax/iron-request.html?body=1" data-turbolinks-track="true" />
    <link rel="import" href="/assets/iron-ajax/iron-ajax.html?body=1" data-turbolinks-track="true" />
    <link rel="import" href="/assets/iron-selector/iron-selection.html?body=1" data-turbolinks-track="true" />
    <link rel="import" href="/assets/iron-selector/iron-selectable.html?body=1" data-turbolinks-track="true" />
    <link rel="import" href="/assets/iron-selector/iron-multi-selectable.html?body=1" data-turbolinks-track="true" />
    <link rel="import" href="/assets/iron-selector/iron-selector.html?body=1" data-turbolinks-track="true" />
    <link rel="import" href="/assets/iron-resizable-behavior/iron-resizable-behavior.html?body=1" data-turbolinks-track="true" />
    <link rel="import" href="/assets/iron-pages/iron-pages.html?body=1" data-turbolinks-track="true" />
    <link rel="import" href="/assets/iron-meta/iron-meta.html?body=1" data-turbolinks-track="true" />
    <link rel="import" href="/assets/iron-flex-layout/iron-flex-layout.html?body=1" data-turbolinks-track="true" />
    <link rel="import" href="/assets/iron-icon/iron-icon.html?body=1" data-turbolinks-track="true" />
    <link rel="import" href="/assets/iron-iconset-svg/iron-iconset-svg.html?body=1" data-turbolinks-track="true" />
    <link rel="import" href="/assets/iron-icons/iron-icons.html?body=1" data-turbolinks-track="true" />
    <link rel="import" href="/assets/iron-a11y-keys-behavior/iron-a11y-keys-behavior.html?body=1" data-turbolinks-track="true" />
    <link rel="import" href="/assets/iron-menu-behavior/iron-menu-behavior.html?body=1" data-turbolinks-track="true" />
    <link rel="import" href="/assets/iron-media-query/iron-media-query.html?body=1" data-turbolinks-track="true" />
    <link rel="import" href="/components/paper-drawer-panel/paper-drawer-panel.css.html" data-turbolinks-track="true" />
    <link rel="import" href="/assets/paper-drawer-panel/paper-drawer-panel.html?body=1" data-turbolinks-track="true" />
    <link rel="import" href="/assets/paper-header-panel/paper-header-panel.html?body=1" data-turbolinks-track="true" />
    <link rel="import" href="/assets/iron-flex-layout/classes/iron-shadow-flex-layout.html?body=1" data-turbolinks-track="true" />
    <link rel="import" href="/assets/iron-flex-layout/classes/iron-flex-layout.html?body=1" data-turbolinks-track="true" />
    <link rel="import" href="/assets/paper-styles/color.html?body=1" data-turbolinks-track="true" />
    <link rel="import" href="/assets/paper-styles/default-theme.html?body=1" data-turbolinks-track="true" />
    <link rel="import" href="/assets/paper-styles/shadow.html?body=1" data-turbolinks-track="true" />
    <link rel="import" href="/assets/paper-styles/typography.html?body=1" data-turbolinks-track="true" />
    <link rel="import" href="/assets/paper-styles/paper-styles.html?body=1" data-turbolinks-track="true" />
    <link rel="import" href="/assets/paper-toolbar/paper-toolbar.html?body=1" data-turbolinks-track="true" />
    <link rel="import" href="/assets/iron-behaviors/iron-control-state.html?body=1" data-turbolinks-track="true" />
    <link rel="import" href="/assets/iron-behaviors/iron-button-state.html?body=1" data-turbolinks-track="true" />
    <link rel="import" href="/assets/paper-behaviors/paper-button-behavior.html?body=1" data-turbolinks-track="true" />
    <link rel="import" href="/assets/paper-behaviors/paper-radio-button-behavior.html?body=1" data-turbolinks-track="true" />
    <link rel="import" href="/assets/paper-ripple/paper-ripple.html?body=1" data-turbolinks-track="true" />
    <link rel="import" href="/assets/paper-icon-button/paper-icon-button.html?body=1" data-turbolinks-track="true" />
    <link rel="import" href="/assets/paper-menu/paper-menu.html?body=1" data-turbolinks-track="true" />
    <link rel="import" href="/assets/paper-material/paper-material.html?body=1" data-turbolinks-track="true" />
    <link rel="import" href="/components/paper-item/paper-item-shared.css.html" data-turbolinks-track="true" />
    <link rel="import" href="/assets/paper-item/paper-item.html?body=1" data-turbolinks-track="true" />
    <link rel="import" href="/assets/iron-menu-behavior/iron-menubar-behavior.html?body=1" data-turbolinks-track="true" />
    <link rel="import" href="/assets/paper-tabs/paper-tabs-icons.html?body=1" data-turbolinks-track="true" />
    <link rel="import" href="/assets/paper-tabs/paper-tab.html?body=1" data-turbolinks-track="true" />
    <link rel="import" href="/assets/paper-tabs/paper-tabs.html?body=1" data-turbolinks-track="true" />
    <link rel="import" href="/assets/paper-button/paper-button.html?body=1" data-turbolinks-track="true" />
    <link rel="import" href="/assets/swala-card.html?body=1" data-turbolinks-track="true" />
    <link rel="import" href="/assets/application.html?body=1" data-turbolinks-track="true" />
    <link rel="stylesheet" media="screen,print" href="/assets/application.css?body=1" shim-shadowdom="true" />
    <link rel="stylesheet" media="screen,print" href="/assets/swalapala_basic.css?body=1" shim-shadowdom="true" />
    <link rel="stylesheet" media="screen,print" href="/assets/animation.css?body=1" shim-shadowdom="true" />
    <link rel="stylesheet" media="screen,print" href="/assets/paper-drawer-panel.css?body=1" shim-shadowdom="true" />
    <link rel="stylesheet" media="screen,print" href="/assets/paper-item-shared.css?body=1" shim-shadowdom="true" />

toggle works not stable on iOS

Primitive. Tap on button opens drawer once. Multiple clicks after have no effect, long tap on button and then it opens once again. Also can pull it out by gesture.

<paper-drawer-panel id="paperDrawerPanel">
            <div drawer></div>
            <div main>
                    <paper-button paper-drawer-toggle raised>toggle drawer</paper-button>
             </div>
</paper-drawer-panel>

XCode log: Uncaught Error: Script error.:0:

Menu wrongly shows up on Firefox (Desktop/Mobile) if mouse/finger is moved to the right

On Chrome the menu panel only shows up, if the menu button is pressed, or the mouse/finger is dragged from the left corner a little to the right.

On Firefox, however, the screen will turn grey on any movement anywhere of the main panel. If the move ends a little right of the starting point, the menu will show up. The touch-movement indicated in red on the screenshot should not open the menu.

This behavior occurs on both Firefox mobile on Android and Firefox desktop on Ubuntu.

touch

Steps to reproduce:

  1. In Firefox go to https://elements.polymer-project.org/bower_components/paper-drawer-panel/demo/index.html
  2. Shrink the window until the drawer is hidden
  3. Press the mouse button anywhere (e. g., far from the left border), move the mouse a little to the right, release mouse button

Expected behaviour:
Nothing happens

Actual behaviour on Firefox (mobile/desktop):
The drawer shows up.

Too easy to accidentally close the drawer when scrolling on mobile

When the drawer contains a tall list and the user wants to scroll that list, it is way too easy to accidentally close the drawer because the finger will drag diagonally and a very little horizontal movement will close the drawer.

In the Inbox app, you have to drag left past 50% width to make the drawer close, similar for opening the drawer. Also, in the Inbox app, when you start scrolling the drawer up or down, the drawer is prevented from closing. The drawer will either close or scroll, but not do both.

I think paper-drawer-panel could temporarily disable dragging when a upward or downward finger movement has been detected.

drawerWidth is not applied

Try to adapt the drawerWidth, but it's not working. Below is the modified demo page.

    <paper-drawer-panel id="paperDrawerPanel" drawerWidth="512px">
      <div drawer>I am drawer</div>
      <div main>
        <div>
          <paper-button onclick="flipDrawer()" raised>flip drawer</paper-button>
        </div>
        <div>
          <paper-button paper-drawer-toggle raised>toggle drawer</paper-button>
        </div>
      </div>
    </paper-drawer-panel>

Menu Button in compact mode is laid on top of the drawer (wrong z-index?)

The menu button in the following code (in narrow mode) shows up on top of the drawer header, when drawer is open. It does not happen if the menu button is not inside paper-toolbar but in a div.
(Seen on chrome: Version 43.0.2357.8)

<paper-drawer-panel>
  <paper-header-panel drawer>
    <paper-toolbar>
      <div>Application</div>
    </paper-toolbar>
    <div> Drawer content... </div>
  </paper-header-panel>
  <paper-header-panel main>
    <paper-toolbar>
      <paper-icon-button icon="menu" paper-drawer-toggle></paper-icon-button>
      <div>Title</div>
    </paper-toolbar>
    <div> Main content... </div>
  </paper-header-panel>
</paper-drawer-panel>

edgeSwipeOverlay blocks menu toggle button on mobile

<div id="edgeSwipeOverlay" class="style-scope paper-drawer-panel">
        </div>

When rendering the drawer panel on a mobile device(Nexus 5) the edgeSwipeOverlay overlaps the toggle menu button in in the main drawer as well parts of elements in the main panel(near left edge). As a workaround I added left margin to all elements in the main panel.

forceNarrow not hiding the drawer

i have a narrow layout type so im using forceNarrow to hide the drawer on larger screen(will show later only on mobile devices by clicking some button).

The drawer will not close with this:
<paper-drawer-panel forceNarrow narrow id="paperDrawerPanel">

Clicking on paper-icon-button[paper-drawer-toggle] doesn't open the drawer

If you adjust the demo to use <paper-icon-button> instead of <button>, the drawer doesn't slide out when you click the icon button.

    <paper-drawer-panel id="paperDrawerPanel">
      <div drawer></div>
      <div main>
        <div>
          <button onclick="flipDrawer()">flip drawer</button>
        </div>
        <div>
          <paper-icon-button icon="menu" paper-drawer-toggle></paper-icon-button>
        </div>
      </div>
    </paper-drawer-panel>

cc @robdodson

Offsetting core drawer panel

I would like to know if we can offset the core drawer panel when the toggle button is clicked so that the drawer scrolls after the toggle button but still the toggle button should be active to be clicked on again to hide the drawer panel.
Also is it possible to make the core drawer panel scroll from bottom, say an options bar that when toggled will scroll up from bottom.

Thanks

paper-drawer-panel demo is not working as expected.

Environment:

Chrome Version 42.0.2311.135 (64-bit) on mac.

bower.json dependencies:
"dependencies": {
"polymer": "polymer/polymer#v0.9.0-rc.1",
"paper-drawer-panel": "PolymerElements/paper-drawer-panel#^0.9.2"
}

Issue:

The toggle button (toggle drawer) does not appear and also the drawer does not hide when browser's width is reduced.

Error:

GET http://localhost:8000/bower_components/paper-styles/demo.css 404 (File not found)
localhost/:20 GET http://localhost:8000/bower_components/paper-styles/default-theme.html 404 (File not found)
gestures.html:222 Uncaught TypeError: Cannot set property 'touchAction' of undefinedGestures.setTouchAction @ gestures.html:222Polymer.Base._addFeature.setScrollDirection @ gestures.html:437Polymer._responsiveChange @ paper-drawer-panel.html:566Polymer.onQueryMatchesChanged @ paper-drawer-panel.html:571(anonymous function) @ events.html:62Polymer.Base._addFeature.fire @ utils.html:157Polymer.Bind._modelApi._notifyChange @ accessors.html:31Polymer.Base.extend._notifyEffect @ effects.html:42(anonymous function) @ accessors.html:71Polymer.Bind._modelApi._effectEffects @ accessors.html:67Polymer.Bind._modelApi._propertySet @ accessors.html:60Polymer.Base._addFeature._applyConfig @ configure.html:152Polymer.Base._addFeature._afterClientsReady @ configure.html:135Polymer.Base._addFeature._ready @ ready.html:98Polymer.Base._addFeature._readyClients @ ready.html:110Polymer.Base._addFeature._ready @ ready.html:96Polymer.Base._addFeature._tryReady @ ready.html:85Polymer.Base._addFeature._initFeatures @ polymer.html:76Polymer.Base.createdCallback @ base.html:30
gestures.html:222 Uncaught TypeError: Cannot set property 'touchAction' of undefined

paper-drawer-panel accessibility report

Here are the accessibility developer tools audit results:

[Warning] Text elements should have a reasonable contrast ratio (1)Not applicable tests (12)Passing tests (4)

IMO, the general contrast is sufficient. It may help to make the text on the button more bold though.ย 

There is something interesting that happens on the demo page when zooming in. If I press command + on my Mac to zoom in on the browser content, the layout changes. After a few zooms in, I see another button: Toggle drawer. This is a confusing experience, since this button did not apear before zooming. Also, when I then try to use the keyboard to untoggle the drawer, I am not able to. I press enter, and the gray overlay does not go away. When the gray overlay is over the button text, that contrast then becomes very poor.

on mobile, when scrolling through buttons next tap/touch/input event is lost

Description

I'm raising the issue here because so far, I can only reproduce this in <paper-drawer-panel>, but it may well originate somewhere else.

On mobile devices, when scrolling through an <iron-list> or <template is="dom-repeat"> of buttons, inside of a <paper-drawer-panel>, the subsequent touch event is "lost", in that for example, if you scroll the list, then tap on an item, or a button elsewhere, the tap event isn't registered by any on-tap handlers (although the ink will show, if it's a <paper-button>, etc.).

I consider this a fairly serious issue, as it makes the mobile experience extremely unpleasant and seemingly buggy.

Platforms affected: Chrome on Android, Firefox on Android, Safari on iOS

Related Issue for Non-chrome Desktop Browsers

I have also noticed that a touch on a button, which is then dragged off before releasing (to avoid activating the button, for example), will produce a similar issue.

Platforms affected: OSX Firefox, OSX Safari, Chrome on Android, Firefox on Android, Safari on iOS

For example, on Firefox or Safari on OSX, if an item in the problematic list above, or a button is clicked, and then dragged away before releasing, the subsequent click event does not call the on-tap handler (but ink effects are generated).

Steps to Reproduce

  1. Create a project with a <paper-drawer-panel> and inside of its main content, put an <iron-list> or <template is="dom-repeat"> whose elements are buttons (e.g., <paper-button>), which have enough items so that the user can scroll.
  2. Also add another button somewhere, say in <paper-header-panel>, which does something obvious like a color change, so that it is easy to recognize when the on-tap method is called on this button.
  3. Scroll through the list of items. If you're using <paper-button> as the elements, you will see ink effects on a touch down.
  4. Stop scrolling, and tap the button in 2. You will notice that whatever logic you put in on-tap was not called (but if it was a <paper-button> its ink effect was triggered). The next tap after this works as usual.

Example

<dom-module id="parent-panel">
  <style>
  </style>
  <template>
    <paper-drawer-panel>
      <paper-header-panel drawer>
        <paper-toolbar>
          <div>Drawer</div>
        </paper-toolbar>
      </paper-header-panel>
      <paper-header-panel mode="standard" main>
        <paper-toolbar id="toolbar" style$="[[_toolbarStyle]]">
          <paper-button raised on-tap="_changeColor">Tap Me</paper-button>
          <h3>On Mobile Scroll, the next touch is lost</h3>
        </paper-toolbar>
          <iron-list items="[[_items]]">
            <template>
              <paper-button on-tap="_tap">[[item]]</paper-button>
            </template>
        </iron-list>
      </paper-header-panel>
    </paper-drawer-panel>
  </template>
  <script>
    Polymer({
      is: "parent-panel",
      properties: {
        _current: {
          value: 0
        },
        _toolbarStyle: {
          value: 'background: blue;'
        },
        _items: {
          type: Array,
          notify: true,
          value: function() { return [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20];}
        }
      },
      _changeColor: function(e){
        console.log('_changeColor');
        this._current = (this._current + 1) % 2;
        this._toolbarStyle = this._current % 2 === 0 ? 'background: blue;' : 'background: red';
      },
      _tap: function(e){
        console.log('tap registered');
      }
    });
  </script>
</dom-module>

JavaScript can't scroll drawer content.

Hi.

I'm using paper-drawer-panel and I want to scroll content of drawer by window.scrollBy(). But it seems that it can't scroll the page.
I checked closed issues related to scrolling in this repository, but I still can't do that.

I made an example to reproduce my problem.

<!DOCTYPE html>
<html>
<head>
    <meta name="viewport" content="width=device-width, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <title>Test</title>

    <script src="bower_components/webcomponentsjs/webcomponents-lite.js"></script>
    <link rel="import" href="bower_components/polymer/polymer.html">

    <link rel="import" href="bower_components/paper-header-panel/paper-header-panel.html">
    <link rel="import" href="bower_components/paper-drawer-panel/paper-drawer-panel.html">
    <link rel="import" href="bower_components/paper-toolbar/paper-toolbar.html">
    <style>
        .foo {
            margin: 10px;
            padding-top: 200px;
            padding-botton: 200px;
            background-color: red;
        }
    </style>
</head>
<body class="fullbleed">
    <paper-drawer-panel>
        <paper-header-panel drawer>
            <paper-toolbar>menu</paper-toolbar>
            <div>
                <div class="foo"></div>
                <div class="foo"></div>
                <div class="foo"></div>
                <div class="foo"></div>
                <div class="foo"></div>
            </div>
        </paper-header-panel>
        <paper-header-panel main>
            <paper-toolbar>header</paper-toolbar>
            <div>
                <div class="foo"></div>
                <div class="foo"></div>
                <div class="foo"></div>
                <div class="foo"></div>
                <div class="foo"></div>
            </div>
        </paper-header-panel>
    </paper-drawer-panel>
</body>
</html>
  1. Make a directory
  2. Copy above code as index.html
  3. Install paper-header-panel, paper-drawer-panel and paper-toolbar with bower
  4. Serve index.html in localhost.
  5. Open the page with Chrome and DevTools
  6. In console of DevTools, try window.scrollBy(0, 100) (no error occurs, but page doesn't scroll)

How can I scroll page from JavaScript?

Environment is:

  • paper-*#^1.0.1 (from catalog)
  • Chrome 44.0.2403.61 beta (64-bit)

Cannot scroll content

The readme states that using a paper-header-panel or css overflow property will allow scrolling, but that doesn't seem to work.

I'm using a paper-header-panel, and when that didn't work, I tried to copy the example from the readme, and add a lot of text to the content area - still no scrolling.

I also tried adding an overflow: scroll css attribute to the paper-header-panel and to the content div which resulted in a grey scroll bar, but effectively didn't add any scrolling capabilities.

Elements inside a drawer are focusable even if the drawer is closed

When you have a right drawer and it's closed, the user can still set the focus to an element inside the drawer. This is causing the drawer to appear in the viewport even though it's "closed".

While debugging, this issue seems to be caused by a browser behavior; an element's is focusable and the browser will calll scrollIntoView if client rect left or top values is greater than the negative values of width or height value of that element. To fix this issue the drawer will need translateY(-100%) only after the animation stops.

paper-drawer-panel and Turbolinks doesn't work

I have a web app with Rails 4 and Turbolinks, https://github.com/rails/turbolinks. Now I've started to add more Polymer elements to the app. But I can't get paper-drawer-panel to work.
When loading the page the first time everything looks and behaves as expected. But when clicking a link the problem starts. I made a video of the problem.
https://www.youtube.com/watch?v=Zqtn9uxI1xs

It seems like the paper-drawer-panel isn't populated with the content after changing page with Turbolinks. I don't think this is a problem with Turbolinks, but more a result of how it works and how paper-drawer-panel works.
I don't really understand how paper-drawer-panel works and load it's content. Therefore I haven't been able to figure out a solution.

But a while ago I had the same problem with jquery.mmenu and Turbolinks.
Problem: https://github.com/BeSite/jQuery.mmenu/issues/41
Solution: http://mmenu.frebsite.nl/tutorials/frameworks/turbolinks.html

Could it be a similar solution to get paper-drawer-panel to work with Turbolinks? All help is appreciated. I really need this one to work in our app, and disabling Turbolinks isn't an option.

UPDATE:
Here is some code.
application.html.haml

!!!
/[if lt IE 7] <html class="no-js lt-ie9 lt-ie8 lt-ie7">
/[if IE 7] <html class="no-js lt-ie9 lt-ie8">
/[if IE 8] <html class="no-js lt-ie9">
%html
  = render 'layouts/head'

  %body{class: "#{body_classes(yield :body_classes)}fullbleed layout vertical"}
    - if current_user
      = render 'layouts/content'
      = render 'shared/notifications'

    - else
      = render 'shared/notifications'
      = yield

    / outdated-browser
    #outdated= render "layouts/outdatedbrowser/#{I18n.locale}"

layouts/_content.html.haml

/ Page Content
%paper-drawer-panel
  %div{:drawer => ""}
    = render 'layouts/menu'

  %div{:main => ""}
    %paper-header-panel{:drawer => ""}
      %paper-toolbar
        %paper-icon-button{:icon => "menu", "paper-drawer-toggle" => ""}
        %div= current_title(yield(:title))
      = yield

does not work in iron/neon pages

Hi,

I like polymer... but I found an error, I think. I'm building on a desktop app with nw.js and using polymer 1.0.3 as UI-System...

Szenario:

  • Landing/ Welcome - Page
  • my app-element with paper-drawer-panel
  • both are in neon-animated-pages in a neon-animatable element, but the app-element doesn't show anything --> i tried the same with iron-pages

when I use the app-element as main element without a pages element... the drawer renders and i can see my toolbar...

release version 1.0.3 don't work properly in Firefox

The drawer panel do not work properly in Firefox (tested on Firefox 39.0), the drawer is always closed, no way to show it and the toggle button is always displayed (but don't work too).

The bug can be tested opening the demo page of the current release version (1.0.3) of paper-drawer-panel (/paper-drawer-panel/demo/index.html) on Firefox.

Changing forceNarrow from true to false is forcing the drawer to display even in mobile view

While changing the forceNarrow attribute from 'true' to 'false' the drawer is forced to display, without checking if the drawer should be displayed at current document width. If the document width is smaller then the responsiveWidth, the drawer should not automatically being displayed.

forceNarrowChanged: function() {
  this._responsiveChange(this.forceNarrow);
}

Setting forceNarrow to 'false' _responsiveChange is called passing 'false'

_responsiveChange: function(narrow) {
  this.narrow = narrow; 

  if (this.narrow) {
    this.selected = this.defaultSelected;
  }

  this.setAttribute('touch-action', this.swipeAllowed() ? 'pan-y' : '');
  this.fire('paper-responsive-change', {narrow: this.narrow});
}

The default display is forced at this point, because 'narrow' is 'false', but this.narrow should be 'true' though.

menu button paper-drawer-toggle bug with opened drawer in narrow mode

menu button paper-drawer-toggle acts when click on opened drawer panel
It is not visible under drawer, but takes action.
bug appears without anything on drawer and also with some content over it.

 <div drawer>
       <paper-menu class="list">
               <paper-item>Inbox</paper-item>
               <paper-item>Starred</paper-item>
               <paper-item>Sent mail</paper-item>
               <paper-item>Drafts</paper-item>
       </paper-menu>
</div>

Unable to style paper-drawer-panel in Polymer 1.0 using Custom CSS Mixins

I am trying to style the paper-drawer-panel using the Custom CSS Mixins as mentioned in the docs. The paper-drawer-panel.css file applies

@apply(--paper-drawer-panel-left-drawer-container);
@apply(--paper-drawer-panel-main-container);
respectively for the drawer and the main containers. But, the styles set using the mixins do not seem to be working.

The below is the code for paper-drawer-panel demo I have used.

    <script src="bower_components/webcomponentsjs/webcomponents-lite.js"></script>

    <link rel="import" href="bower_components/paper-styles/paper-styles.html">
    <link rel="stylesheet" href="bower_components/paper-styles/demo.css">

    <link rel="import" href="bower_components/paper-button/paper-button.html">
    <link rel="import" href="bower_components/paper-drawer-panel/paper-drawer-panel.html">

    <style>
    #drawerPanel {
    --paper-drawer-panel-left-drawer-container: {
      background-color: #eee;
    };
    --paper-drawer-panel-main-container: {
      background-color: gray;
    };
  }
    </style>
  </head>

  <body class="unresolved fullbleed">

    <paper-drawer-panel id="drawerPanel">
    <div drawer> 
        <div>Drawer content... </div>
    </div>
    <div main>
        <div>
          <paper-button paper-drawer-toggle raised>toggle drawer</paper-button>
        </div>
      </div>
    </paper-drawer-panel>
  </body>

The backgrounds are not getting applied to the drawer and main sections. Or am I missing something simple?

does not render properly in Firefox, IE

The example code in the docs does not render properly in FF38 and IE11.

<paper-drawer-panel>
  <paper-header-panel drawer>
    <paper-toolbar>
      <div>Application</div>
    </paper-toolbar>
    <div> Drawer content... </div>
  </paper-header-panel>
  <paper-header-panel main>
    <paper-toolbar>
      <paper-icon-button icon="menu" paper-drawer-toggle></paper-icon-button>
      <div>Title</div>
    </paper-toolbar>
    <div> Main content... </div>
  </paper-header-panel>
</paper-drawer-panel>

In FF, drawer seems to be truncated. paper-drawer-toggle doesn't work.

paper-drawer-panel-ff

IE's worse:

paper-drawer-panel-ie

Changing to the full webcomponents.min.js polyfill didn't help.

forceNarrow's observer is setup incorrectly

There is an observer for the property forceNarrow:

forceNarrow: {
  observer: 'forceNarrowChanged',
  type: Boolean,
  value: false
},

but forceNarrowChanged also relies on the property defaultSelected and there is no guarantee that you get all the configured values before observers run. So it is better to make sure the observer declare all the dependent properties.

A possible fix:

observers: [
  'forceNarrowChanged(forceNarrow, defaultSelected)'
],

Can't get content to scroll in the main panel

The example provided at the end of on https://elements.polymer-project.org/elements/paper-drawer-panel (the div with "main content" does not scroll) (the third example)

Using:
paper-elements#~1.0.1
chromer version: Version 43.0.2357.81 (64-bit)

<paper-drawer-panel>
  <paper-header-panel drawer>
    <paper-toolbar>
      <div>Application</div>
    </paper-toolbar>
    <div> Drawer content... </div>
  </paper-header-panel>
  <paper-header-panel main>
    <paper-toolbar>
      <paper-icon-button icon="menu" paper-drawer-toggle></paper-icon-button>
      <div>Title</div>
    </paper-toolbar>
    <div>
      <div> Main content... </div>
      <div> Main content... </div>
      <div> Main content... </div>
      <div> Main content... </div>
    </div>

  </paper-header-panel>
</paper-drawer-panel>

bug in documentation

In documentation attribute forceNarrow should be changed to force-narrow. I've lost few hours on resolving this :)

drawerToggleAttribute

if you customize this property, it won't hide the toggle element in narrow layout.

Ripples are almost invisible if they are put inside the drawer-panel

If you put paper-checkbox or paper-radio-button inside the paper-drawer-panel you will notice if you tap on them the ripple is very light, almost invisible.

<paper-drawer-panel>
  <div drawer></div>
  <div main>
    <div>
      <paper-button paper-drawer-toggle raised>toggle drawer</paper-button>
    </div>
    <div style="padding: 30px;">
      <paper-checkbox></paper-checkbox>
    </div>
  </div>
</paper-drawer-panel>

iPhone loading issues

Running a drawer on iPhone Chrome and Safari takes an unreasonably long time to load the element along. Along with this, the drawer is shown during this load period even with force-narrow set to true. I have only tested this with an iPhone 5 on iOS 8.3. If anybody needs an example, my website is currently running it at jlmiller.guru.

Support two side drawers.

A number of Android applications support a right-hand drawer as well (accessed by the kebab menu). Would it be possible to support this?

paper-drawer-panel focus state issue

The focus state is too light, especially on top of the colored background. I have to strain pretty hard to tell when the button is in focus or not.

Error when i put a paper-input inside a paper-drawer-panel

From @ypicoleal on June 16, 2015 23:7

Hi partners!

when it loads the page, the paper-drawer-panel aligned to the right, i should be collapsed, but instead it charges full loaded.

when i call the togglePanel function it bumps and then it midly works.

this only happens when there is a paper-input inside a paper-drawer-panel

<paper-drawer-panel id="dmenu" responsive-width="1980px" right-drawer>
        <div drawer>
            <paper-toolbar>
                Title
            </paper-toolbar>
            <div id="drawerContent">
                <form id="form" action="http://localhost/site" method="post">  
                      <paper-input floating-label name="id" label="reporte"></paper-input>
                      <paper-input floating-label name="latitud" label="latitud"></paper-input>
                      <paper-input floating-label name="longitud" label="longitud"></paper-input>
                      <paper-input floating-label name="nombre" label="nombre"></paper-input>
                      <paper-textarea floating-label name="descripcion" label="descripcion"></paper-textarea>
                      <input type="hidden" name="basurero"/>
                      <paper-button raised onclick="submitForm()">Enviar</paper-button>
                </form>
            </div>
        </div>
        <div main>
            <paper-icon-button icon="menu" onclick="document.getElementById('dmenu').togglePanel()"></paper-icon-button>
            hello world
        </div>
    </paper-drawer-panel>

Please, hope you can help me with this

Copied from original issue: Polymer/polymer#1893

Missing property value

I try to use the paper-drawer-panel, but I can't get it to work. I just get this message.
paper-drawer-panel.css:31
@apply(--paper-drawer-panel-drawer-container);

Edit:
I use Ruby on Rails 4 also.

Does anyone know why I get this error?
screenshot from 2015-06-24 09 16 47

paper-select event does not fire

From the source:

/**
* Fired when the selected panel changes.
*
* Listening for this event is an alternative to observing changes in the selected attribute.
* This event is fired both when a panel is selected and deselected.
* The isSelected detail property contains the selection state.
*
* @event paper-select {{isSelected: boolean, item: Object}} detail -
* isSelected: True for selection and false for deselection.
* item: The panel that the event refers to.
*/

I'm listening for the paper-select event, but it never fires. The paper-responsive-change works just fine. With developer tools I can see that the selected attribute does change, but the event never occurs.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.