From e2f95e06d3a8dd136c81f91eac07e44cfc21a555 Mon Sep 17 00:00:00 2001 From: Samuel Li Date: Mon, 11 Apr 2016 15:30:31 +1000 Subject: [PATCH] Advance to year field when / is pressed --- bower.json | 3 ++- date-input.html | 12 +++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/bower.json b/bower.json index e59263b..7f6d6b8 100644 --- a/bower.json +++ b/bower.json @@ -27,7 +27,8 @@ "iron-form-element-behavior": "PolymerElements/iron-form-element-behavior#^1.0.0", "paper-input": "PolymerElements/paper-input#^1.0.0", "paper-styles": "PolymerElements/paper-styles#^1.0.0", - "polymer": "Polymer/polymer#^1.1.0" + "polymer": "Polymer/polymer#^1.1.0", + "iron-a11y-keys-behavior": "PolymerElements/iron-a11y-keys-behavior#^1.1.2" }, "devDependencies": { "iron-component-page": "PolymerElements/iron-component-page#^1.0.0", diff --git a/date-input.html b/date-input.html index 3485c3a..d982d9d 100644 --- a/date-input.html +++ b/date-input.html @@ -8,6 +8,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt --> + @@ -100,7 +101,8 @@ is: 'date-input', behaviors: [ - Polymer.IronValidatableBehavior + Polymer.IronValidatableBehavior, + Polymer.IronA11yKeysBehavior ], properties: { @@ -149,6 +151,14 @@ '_computeDate(month,year)' ], + keyBindings: { + '\\': '_selectYear' + }, + + _selectYear: function() { + this.$.expirationYear.focus(); + }, + _computeDate: function(month, year) { // Months are 0-11. this.date = {month: month, year: year};