summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authorVincent Schippefilt <vsc@odoo.com>2018-04-23 16:11:50 +0200
committerVincent Schippefilt <vsc@odoo.com>2018-04-25 09:11:44 +0200
commitde72b13064df5683dcde45b2b1704787dfb08108 (patch)
treea194495bbb1066c36cf4f7de50720819f2edb42f /addons
parentec5e27bb7cc7808d7128eae4e7e67910f40492c0 (diff)
[FIX] web: fix crash keyboard related crash in graph view
Before this fix, when going on the graph view from the dashboard view ( using the fullscreen button on dashboard), the focus is on the search input, hitting the tab key creates a crash. This fix gives a default implementation of giveFocus to the abstractrenderer so there is no crash.
Diffstat (limited to 'addons')
-rw-r--r--addons/web/static/src/js/views/abstract_renderer.js5
-rw-r--r--addons/web/static/src/js/views/basic/basic_renderer.js7
-rw-r--r--addons/web/static/tests/views/graph_tests.js16
3 files changed, 21 insertions, 7 deletions
diff --git a/addons/web/static/src/js/views/abstract_renderer.js b/addons/web/static/src/js/views/abstract_renderer.js
index 2394fb31a64..059380f87bd 100644
--- a/addons/web/static/src/js/views/abstract_renderer.js
+++ b/addons/web/static/src/js/views/abstract_renderer.js
@@ -67,6 +67,11 @@ return Widget.extend({
getLocalState: function () {
},
/**
+ * Order to focus to be given to the content of the current view
+ */
+ giveFocus: function () {
+ },
+ /**
* This is the reverse operation from getLocalState. With this method, we
* expect the renderer to restore all DOM state, if it is relevant.
*
diff --git a/addons/web/static/src/js/views/basic/basic_renderer.js b/addons/web/static/src/js/views/basic/basic_renderer.js
index 80cdd05bff5..1dae9f705ff 100644
--- a/addons/web/static/src/js/views/basic/basic_renderer.js
+++ b/addons/web/static/src/js/views/basic/basic_renderer.js
@@ -135,13 +135,6 @@ var BasicRenderer = AbstractRenderer.extend({
dom.setSelectionRange(field.getFocusableElement().get(0), {start: offset, end: offset});
}
},
-
- /**
- * Order to focus to be given to the content of the current view
- */
- giveFocus:function() {
- },
-
//--------------------------------------------------------------------------
// Private
//--------------------------------------------------------------------------
diff --git a/addons/web/static/tests/views/graph_tests.js b/addons/web/static/tests/views/graph_tests.js
index a13130e4b27..028eb4cb3a3 100644
--- a/addons/web/static/tests/views/graph_tests.js
+++ b/addons/web/static/tests/views/graph_tests.js
@@ -602,6 +602,22 @@ QUnit.module('Views', {
done();
});
});
+
+ QUnit.test('graph view crash when moving from search view using Down key', function (assert) {
+ assert.expect(1);
+
+ var graph = createView({
+ View: GraphView,
+ model: "foo",
+ data: this.data,
+ arch: '<graph string="Partners" type="pie">' +
+ '<field name="bar"/>' +
+ '</graph>',
+ });
+ graph.renderer.giveFocus();
+ assert.ok(true,"should not generate any error");
+ graph.destroy();
+ });
});
});