Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Commit

Permalink
Merge pull request #15299 from mcav/clock-alarm-enter-v1.3
Browse files Browse the repository at this point in the history
Bug 946106 - [fugu][buri]pressing enter on the keyboard does not save alarm. r=mcav
  • Loading branch information
mcav committed Jan 14, 2014
2 parents 5a9cae9 + 62aef33 commit 1db59bf
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions apps/clock/js/alarm_edit.js
Expand Up @@ -98,9 +98,21 @@ var AlarmEdit = {
this.selects.sound.addEventListener('blur', this);
this.selects.repeat.addEventListener('change', this);
this.buttons.delete.addEventListener('click', this);
this.inputs.name.addEventListener('keypress', this.handleNameInput);
this.init = function() {};
},

handleNameInput: function(evt) {
// If the user presses enter on the name label, dismiss the
// keyboard to allow them to continue filling out the other
// fields. This is not in the `handleEvent` function because we
// only want to call `.preventDefault` sometimes.
if (evt.keyCode === KeyEvent.DOM_VK_RETURN) {
evt.preventDefault();
evt.target.blur();
}
},

handleEvent: function aev_handleEvent(evt) {
evt.preventDefault();
var input = evt.target;
Expand Down

0 comments on commit 1db59bf

Please sign in to comment.