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

Unified Diff: third_party/polymer/v1_0/components-chromium/paper-tabs/paper-tab-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-tabs/paper-tab-extracted.js
diff --git a/third_party/polymer/v1_0/components-chromium/paper-tabs/paper-tab-extracted.js b/third_party/polymer/v1_0/components-chromium/paper-tabs/paper-tab-extracted.js
index ff390ed303beb33241a0c380f92e066f8e7ba03e..640f02b1323d53588fa469ae3ab69f2289c48ac6 100644
--- a/third_party/polymer/v1_0/components-chromium/paper-tabs/paper-tab-extracted.js
+++ b/third_party/polymer/v1_0/components-chromium/paper-tabs/paper-tab-extracted.js
@@ -7,12 +7,27 @@ Polymer({
Polymer.PaperRippleBehavior
],
+ properties: {
+
+ /**
+ * If true, the tab will forward keyboard clicks (enter/space) to
+ * the first anchor element found in its descendants
+ */
+ link: {
+ type: Boolean,
+ value: false,
+ reflectToAttribute: true
+ }
+
+ },
+
hostAttributes: {
role: 'tab'
},
listeners: {
- down: '_updateNoink'
+ down: '_updateNoink',
+ tap: '_onTap'
},
attached: function() {
@@ -26,5 +41,24 @@ Polymer({
_updateNoink: function() {
this.noink = !!this.noink || !!this._parentNoink;
+ },
+
+ _onTap: function(event) {
+ if (this.link) {
+ var anchor = this.queryEffectiveChildren('a');
+
+ if (!anchor) {
+ return;
+ }
+
+ // Don't get stuck in a loop delegating
+ // the listener from the child anchor
+ if (event.target === anchor) {
+ return;
+ }
+
+ anchor.click();
+ }
}
+
});

Powered by Google App Engine
This is Rietveld 408576698