[FIX] focusing of form fields, implementation of focusing for tag m2m
jQuery's *focus* method must *not* be used: it triggers the blur and focus events in the wrong order (and potentially more than once), breaking the focus handling of the o2m editable list and making it essentially unusable. The DOM method behaves correctly, triggers the blur first and the focus second in a different runloop frame (thus it's possible to bind on blur, wait a set time and execute the actual blurring iif no focus event has been seen within the form). bzr revid: xmo@openerp.com-20121211145652-y63a0ny0gmoiozhn
This commit is contained in:
parent
6576b52d42
commit
bc8e74d8b0
|
@ -2275,7 +2275,7 @@ instance.web.form.FieldChar = instance.web.form.AbstractField.extend(instance.we
|
|||
return this.get('value') === '' || this._super();
|
||||
},
|
||||
focus: function() {
|
||||
this.$('input:first').focus();
|
||||
this.$('input:first')[0].focus();
|
||||
},
|
||||
set_dimensions: function (height, width) {
|
||||
this._super(height, width);
|
||||
|
@ -2510,7 +2510,7 @@ instance.web.form.FieldDatetime = instance.web.form.AbstractField.extend(instanc
|
|||
},
|
||||
focus: function() {
|
||||
if (this.datewidget && this.datewidget.$input) {
|
||||
this.datewidget.$input.focus();
|
||||
this.datewidget.$input[0].focus();
|
||||
}
|
||||
},
|
||||
set_dimensions: function (height, width) {
|
||||
|
@ -2584,7 +2584,7 @@ instance.web.form.FieldText = instance.web.form.AbstractField.extend(instance.we
|
|||
return this.get('value') === '' || this._super();
|
||||
},
|
||||
focus: function($el) {
|
||||
this.$textarea.focus();
|
||||
this.$textarea[0].focus();
|
||||
},
|
||||
set_dimensions: function (height, width) {
|
||||
this._super(height, width);
|
||||
|
@ -2665,7 +2665,7 @@ instance.web.form.FieldBoolean = instance.web.form.AbstractField.extend({
|
|||
this.$checkbox[0].checked = this.get('value');
|
||||
},
|
||||
focus: function() {
|
||||
this.$checkbox.focus();
|
||||
this.$checkbox[0].focus();
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -2751,7 +2751,7 @@ instance.web.form.FieldSelection = instance.web.form.AbstractField.extend(instan
|
|||
}
|
||||
},
|
||||
focus: function() {
|
||||
this.$el.find('select:first').focus();
|
||||
this.$('select:first')[0].focus();
|
||||
},
|
||||
set_dimensions: function (height, width) {
|
||||
this._super(height, width);
|
||||
|
@ -3237,7 +3237,7 @@ instance.web.form.FieldMany2One = instance.web.form.AbstractField.extend(instanc
|
|||
},
|
||||
focus: function () {
|
||||
if (!this.get('effective_readonly')) {
|
||||
this.$input.focus();
|
||||
this.$input[0].focus();
|
||||
}
|
||||
},
|
||||
_quick_create: function() {
|
||||
|
@ -4087,6 +4087,9 @@ instance.web.form.FieldMany2ManyTags = instance.web.form.AbstractField.extend(in
|
|||
add_id: function(id) {
|
||||
this.set({'value': _.uniq(this.get('value').concat([id]))});
|
||||
},
|
||||
focus: function () {
|
||||
this.$text[0].focus();
|
||||
},
|
||||
});
|
||||
|
||||
/**
|
||||
|
@ -4423,7 +4426,7 @@ instance.web.form.Many2ManyQuickCreate = instance.web.Widget.extend({
|
|||
});
|
||||
},
|
||||
focus: function() {
|
||||
this.$text.focus();
|
||||
this.$text[0].focus();
|
||||
},
|
||||
add_id: function(id) {
|
||||
var self = this;
|
||||
|
|
Loading…
Reference in New Issue