Skip to content
This repository has been archived by the owner on May 15, 2023. It is now read-only.

Commit

Permalink
Advance to year field when / is pressed
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelli committed Apr 12, 2016
1 parent cc568c5 commit e2f95e0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
3 changes: 2 additions & 1 deletion bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
12 changes: 11 additions & 1 deletion date-input.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
-->
<link rel="import" href="../polymer/polymer.html">
<link rel="import" href="../iron-a11y-keys-behavior/iron-a11y-keys-behavior.html">
<link rel="import" href="../iron-input/iron-input.html">
<link rel="import" href="../iron-flex-layout/iron-flex-layout.html">
<link rel="import" href="../iron-validatable-behavior/iron-validatable-behavior.html">
Expand Down Expand Up @@ -100,7 +101,8 @@
is: 'date-input',

behaviors: [
Polymer.IronValidatableBehavior
Polymer.IronValidatableBehavior,
Polymer.IronA11yKeysBehavior
],

properties: {
Expand Down Expand Up @@ -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};
Expand Down

0 comments on commit e2f95e0

Please sign in to comment.