summaryrefslogtreecommitdiff
path: root/addons/web/static/src
diff options
context:
space:
mode:
authorAaron Bohy <aab@odoo.com>2019-04-04 13:11:03 +0000
committerAaron Bohy <aab@odoo.com>2019-04-08 11:32:18 +0000
commit8d34eb1328b74ec3a8e3a2cc2edaeadb4c46ffbb (patch)
tree347c0acc5e1ca30c0d0aec81ca40eb562662cb43 /addons/web/static/src
parent92313e11dc3182f850f090f615e645f0d40bcb71 (diff)
[FIX] web: editable list: shift-tab and readonly fields
Before this rev., navigating with shift-tab didn't produce the expected result when there were readonly fields on the way. For instance, pressing shift-tab on a field: - to the right of a readonly field: the focus was kept in the current field, whereas it should have been moved to the first editable field to the left of the readonly one - in the editable first cell of a row, with a readonly field in the last column: the focus was moved to the previous line, which is ok, but on the first editable cell of it, whereas it should have been on the last editable cell. @KangOl this commit needs to be forwardported up to saas-12.2, not later (the code slightly changed in saas-12.3, and we did another version of the fix).
Diffstat (limited to 'addons/web/static/src')
-rw-r--r--addons/web/static/src/js/views/list/list_editable_renderer.js9
1 files changed, 6 insertions, 3 deletions
diff --git a/addons/web/static/src/js/views/list/list_editable_renderer.js b/addons/web/static/src/js/views/list/list_editable_renderer.js
index 185a385a812..07363b2febd 100644
--- a/addons/web/static/src/js/views/list/list_editable_renderer.js
+++ b/addons/web/static/src/js/views/list/list_editable_renderer.js
@@ -478,7 +478,8 @@ ListRenderer.include({
*/
_moveToPreviousLine: function () {
if (this.currentRow > 0) {
- this._selectCell(this.currentRow - 1, this.columns.length - 1);
+ // FORWARD-PORT THIS COMMIT UP TO SAAS-12.2
+ this._selectCell(this.currentRow - 1, this.columns.length - 1, {inc: -1});
} else {
this.unselectRow().then(this.trigger_up.bind(this, 'add_record'));
}
@@ -692,6 +693,8 @@ ListRenderer.include({
* @param {boolean} [options.force=false] if true, force selecting the cell
* even if seems to be already the selected one (useful after a re-
* rendering, to reset the focus on the correct field)
+ * @param {integer} [options.inc=1] the increment to use when searching for
+ * the "next" possible cell (if the cell to select can't be selected)
* @return {Deferred} fails if no cell could be selected
*/
_selectCell: function (rowIndex, fieldIndex, options) {
@@ -715,7 +718,7 @@ ListRenderer.include({
var oldFieldIndex = self.currentFieldIndex;
self.currentFieldIndex = fieldIndex;
fieldIndex = self._activateFieldWidget(record, fieldIndex, {
- inc: 1,
+ inc: options.inc || 1,
wrap: wrap,
event: options && options.event,
});
@@ -868,7 +871,7 @@ ListRenderer.include({
switch (ev.data.direction) {
case 'previous':
if (this.currentFieldIndex > 0) {
- this._selectCell(this.currentRow, this.currentFieldIndex - 1, {wrap: false})
+ this._selectCell(this.currentRow, this.currentFieldIndex - 1, {inc: -1, wrap: false})
.fail(this._moveToPreviousLine.bind(this));
} else {
this._moveToPreviousLine();