diff --git a/app/scripts/templates/age.mustache b/app/scripts/templates/age.mustache index ce4fa5e76..bdfeabff5 100644 --- a/app/scripts/templates/age.mustache +++ b/app/scripts/templates/age.mustache @@ -30,8 +30,4 @@ - - diff --git a/app/scripts/views/age.js b/app/scripts/views/age.js index e94c04d90..5aea24ea4 100644 --- a/app/scripts/views/age.js +++ b/app/scripts/views/age.js @@ -20,7 +20,7 @@ function (BaseView, AgeTemplate) { events: { 'submit form': 'age', - 'click #fxa-age-back': 'back', + 'keyup select': 'enableButtonWhenValid', 'change select': 'enableButtonWhenValid' }, @@ -38,13 +38,7 @@ function (BaseView, AgeTemplate) { router.navigate(nextStep, { trigger: true }); }, - back: function (event) { - event.preventDefault(); - - window.history.back(); - }, - - isValid: function() { + isValid: function () { return this._validateYear(); }, diff --git a/app/scripts/views/base.js b/app/scripts/views/base.js index ff5ecf975..8447a0307 100644 --- a/app/scripts/views/base.js +++ b/app/scripts/views/base.js @@ -9,6 +9,8 @@ define([ 'backbone' ], function(_, Backbone) { + var ENTER_BUTTON_CODE = 13; + var BaseView = Backbone.View.extend({ constructor: function(options) { this.subviews = []; @@ -103,6 +105,20 @@ function(_, Backbone) { displayError: function(msg) { // TODO - run the error message through the translator this.$('.error').html(msg); + }, + + back: function (event) { + if (event) { + event.preventDefault(); + } + + window.history.back(); + }, + + backOnEnter: function (event) { + if (event.which === ENTER_BUTTON_CODE) { + window.history.back(); + } } }); diff --git a/app/scripts/views/pp.js b/app/scripts/views/pp.js index 8a8d5dd78..9c90f52b9 100644 --- a/app/scripts/views/pp.js +++ b/app/scripts/views/pp.js @@ -14,13 +14,9 @@ function (BaseView, PpTemplate) { className: 'pp', events: { - 'click #fxa-pp-back': 'back' - }, - - back: function () { - window.history.back(); + 'click #fxa-pp-back': 'back', + 'keyup #fxa-pp-back': 'backOnEnter' } - }); return PpView; diff --git a/app/scripts/views/tos.js b/app/scripts/views/tos.js index a4764944a..863615f28 100644 --- a/app/scripts/views/tos.js +++ b/app/scripts/views/tos.js @@ -14,13 +14,9 @@ function (BaseView, TosTemplate) { className: 'tos', events: { - 'click #fxa-tos-back': 'back' - }, - - back: function () { - window.history.back(); + 'click #fxa-tos-back': 'back', + 'keyup #fxa-tos-back': 'backOnEnter' } - }); return TosView; diff --git a/app/styles/main.css b/app/styles/main.css index 88287c45b..3b9cd9188 100644 --- a/app/styles/main.css +++ b/app/styles/main.css @@ -168,7 +168,9 @@ section p { text-decoration: none; } -.button-row button:active { +.button-row button:active, +.button-row button:hover, +.button-row button:focus { background: #FF9500; }