Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(93)

Unified Diff: third_party/polymer/v1_0/components-chromium/paper-drawer-panel/paper-drawer-panel-extracted.js

Issue 1862213002: Roll third_party/polymer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove obsolete appearance_browsertest.js, result of a previous bad merge. Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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();
}
},

Powered by Google App Engine
This is Rietveld 408576698