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

Unified Diff: third_party/polymer/v1_0/components-chromium/iron-menu-behavior/iron-menu-behavior-extracted.js

Issue 2314283002: Roll Polymer (Closed)
Patch Set: dep Created 4 years, 3 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/iron-menu-behavior/iron-menu-behavior-extracted.js
diff --git a/third_party/polymer/v1_0/components-chromium/iron-menu-behavior/iron-menu-behavior-extracted.js b/third_party/polymer/v1_0/components-chromium/iron-menu-behavior/iron-menu-behavior-extracted.js
index 5a2f4206f3f6b1f86b733074788eb98120a4de78..bb0ed59e2e21ff20d5f661090b23079d7bca2f0c 100644
--- a/third_party/polymer/v1_0/components-chromium/iron-menu-behavior/iron-menu-behavior-extracted.js
+++ b/third_party/polymer/v1_0/components-chromium/iron-menu-behavior/iron-menu-behavior-extracted.js
@@ -128,11 +128,18 @@
_focusPrevious: function() {
var length = this.items.length;
var curFocusIndex = Number(this.indexOf(this.focusedItem));
+
for (var i = 1; i < length + 1; i++) {
var item = this.items[(curFocusIndex - i + length) % length];
if (!item.hasAttribute('disabled')) {
+ var owner = Polymer.dom(item).getOwnerRoot() || document;
this._setFocusedItem(item);
- return;
+
+ // Focus might not have worked, if the element was hidden or not
+ // focusable. In that case, try again.
+ if (Polymer.dom(owner).activeElement == item) {
+ return;
+ }
}
}
},
@@ -145,11 +152,18 @@
_focusNext: function() {
var length = this.items.length;
var curFocusIndex = Number(this.indexOf(this.focusedItem));
+
for (var i = 1; i < length + 1; i++) {
var item = this.items[(curFocusIndex + i) % length];
if (!item.hasAttribute('disabled')) {
+ var owner = Polymer.dom(item).getOwnerRoot() || document;
this._setFocusedItem(item);
- return;
+
+ // Focus might not have worked, if the element was hidden or not
+ // focusable. In that case, try again.
+ if (Polymer.dom(owner).activeElement == item) {
+ return;
+ }
}
}
},

Powered by Google App Engine
This is Rietveld 408576698