General bug fixes

This commit is contained in:
Nathan Byrd 2022-01-28 10:33:04 -06:00
parent 1bc9830202
commit 10c9ea9554
4 changed files with 19 additions and 65 deletions

View file

@ -21,7 +21,8 @@ function ButtonView(options) {
util.inherits(ButtonView, TextView);
ButtonView.prototype.onKeyPress = function(ch, key) {
if(this.isKeyMapped('accept', key.name) || ' ' === ch) {
let actionForKeyName = key ? key.name : ch;
if(this.isKeyMapped('accept', actionForKeyName) || ' ' === ch) {
this.submitData = 'accept';
this.emit('action', 'accept');
delete this.submitData;
@ -29,16 +30,6 @@ ButtonView.prototype.onKeyPress = function(ch, key) {
ButtonView.super_.prototype.onKeyPress.call(this, ch, key);
}
};
/*
ButtonView.prototype.onKeyPress = function(ch, key) {
// allow space = submit
if(' ' === ch) {
this.emit('action', 'accept');
}
ButtonView.super_.prototype.onKeyPress.call(this, ch, key);
};
*/
ButtonView.prototype.getData = function() {
return this.submitData || null;