| Index: third_party/polymer/v1_0/components-chromium/paper-drawer-panel/paper-drawer-panel-extracted.js
|
| diff --git a/third_party/polymer/v1_0/components-chromium/paper-drawer-panel/paper-drawer-panel-extracted.js b/third_party/polymer/v1_0/components-chromium/paper-drawer-panel/paper-drawer-panel-extracted.js
|
| index 910830b5ddc39d31cd6512189f76e29eb21e4695..e7cb6630a9bd4f6629696e0eeae8b52ab23ab486 100644
|
| --- a/third_party/polymer/v1_0/components-chromium/paper-drawer-panel/paper-drawer-panel-extracted.js
|
| +++ b/third_party/polymer/v1_0/components-chromium/paper-drawer-panel/paper-drawer-panel-extracted.js
|
| @@ -171,6 +171,8 @@
|
| /**
|
| * The panel that is being selected. `drawer` for the drawer panel and
|
| * `main` for the main panel.
|
| + *
|
| + * @type {string|null}
|
| */
|
| selected: {
|
| reflectToAttribute: true,
|
| @@ -192,6 +194,9 @@
|
| * The CSS selector for the element that should receive focus when the drawer is open.
|
| * By default, when the drawer opens, it focuses the first tabbable element. That is,
|
| * the first element that can receive focus.
|
| + *
|
| + * To disable this behavior, you can set `drawerFocusSelector` to `null` or an empty string.
|
| + *
|
| */
|
| drawerFocusSelector: {
|
| type: String,
|
| @@ -488,28 +493,32 @@
|
|
|
| _getAutoFocusedNode: function() {
|
| var drawerContent = this._getDrawerContent();
|
| - return Polymer.dom(drawerContent).querySelector(this.drawerFocusSelector) || drawerContent;
|
| +
|
| + return this.drawerFocusSelector ?
|
| + Polymer.dom(drawerContent).querySelector(this.drawerFocusSelector) || drawerContent : null;
|
| },
|
|
|
| _toggleFocusListener: function(selected) {
|
| if (selected === 'drawer') {
|
| - document.addEventListener('focus', this._boundFocusListener, true);
|
| + this.addEventListener('focus', this._boundFocusListener, true);
|
| } else {
|
| - document.removeEventListener('focus', this._boundFocusListener, true);
|
| + this.removeEventListener('focus', this._boundFocusListener, true);
|
| }
|
| },
|
|
|
| _didFocus: function(event) {
|
| + var autoFocusedNode = this._getAutoFocusedNode();
|
| + if (!autoFocusedNode) {
|
| + return;
|
| + }
|
| +
|
| var path = Polymer.dom(event).path;
|
| var focusedChild = path[0];
|
| var drawerContent = this._getDrawerContent();
|
| - var focusedChildCameFromDrawer = false;
|
| - var autoFocusedNode = this._getAutoFocusedNode();
|
| + var focusedChildCameFromDrawer = path.indexOf(drawerContent) !== -1;
|
|
|
| - while (!focusedChildCameFromDrawer && path[0] && path[0].hasAttribute) {
|
| - focusedChildCameFromDrawer = path.shift() === drawerContent;
|
| - }
|
| - if (!focusedChildCameFromDrawer && autoFocusedNode) {
|
| + if (!focusedChildCameFromDrawer) {
|
| + event.stopPropagation();
|
| autoFocusedNode.focus();
|
| }
|
| },
|
|
|