[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:
@@ -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);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user