[FIX] web: allow to move cursor in inputs with arrows

Commit 9966e4b added calls to preventDefault() on the keydown event
for left, right, up and down arrows, to prevent the page from
scrolling. However, it also prevents the cursor from moving inside
the inputs. Since the initial issue only concerned checkboxes, this
rev. moves the preventDefault() calls from AbstractField to
FieldBoolean.
This commit is contained in:
Aaron Bohy
2017-06-16 08:00:24 +02:00
parent f4200f376b
commit 1fa67917ba
2 changed files with 5 additions and 4 deletions
@@ -426,22 +426,18 @@ var AbstractField = Widget.extend({
this.trigger_up('navigation_move', {direction: 'cancel'});
break;
case $.ui.keyCode.UP:
ev.preventDefault();
ev.stopPropagation();
this.trigger_up('navigation_move', {direction: 'up'});
break;
case $.ui.keyCode.RIGHT:
ev.preventDefault();
ev.stopPropagation();
this.trigger_up('navigation_move', {direction: 'right'});
break;
case $.ui.keyCode.DOWN:
ev.preventDefault();
ev.stopPropagation();
this.trigger_up('navigation_move', {direction: 'down'});
break;
case $.ui.keyCode.LEFT:
ev.preventDefault();
ev.stopPropagation();
this.trigger_up('navigation_move', {direction: 'left'});
break;
@@ -686,6 +686,11 @@ var FieldBoolean = AbstractField.extend({
this.$input.prop('checked', !this.value);
this._setValue(!this.value);
return;
case $.ui.keyCode.UP:
case $.ui.keyCode.RIGHT:
case $.ui.keyCode.DOWN:
case $.ui.keyCode.LEFT:
ev.preventDefault();
}
this._super.apply(this, arguments);
},