From 580456b6ab36d16195eae9ffd776ff245ecd936e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9ry=20Debongnie?= Date: Wed, 3 Mar 2021 14:53:54 +0000 Subject: [FIX] web: prevent traceback when pressing TAB in color_picker widget The color_picker widget, that can be seen for example in the track form view for event tracks, had an issue: if the user clicked on it, then pressed TAB, a traceback was displayed. The problem comes from the fact that the color picker widget inherits from FieldInput, but is not a fieldinput, so many expectations made by the FieldInput code do not hold, such as the code run when handling navigation (by TAB and such keypress). Because of that, the code in _onNavigationMove crashed, because it expected an input. Since this is a bug fix, I simply disabled the navigation in that case, so no crash happens. Sadly, this widget has still a big issue: it clearly does not work as most users would expect: pressing TAB or arrows should update the selection. But this would be a more complicated refactoring, for a bug which is clearly not critical, therefore this commit implements the simple and safe solution. Also, we disable the focus outline to minimize the wrong expectation. Seeing them kind of implied that one could update the selection with the keyboard. Note that the widget color_picker was moved from another addon to web/, without any tests nor documentation. OPW 2467369 closes odoo/odoo#67174 Signed-off-by: Aaron Bohy (aab) --- addons/web/static/src/js/fields/basic_fields.js | 3 +++ 1 file changed, 3 insertions(+) (limited to 'addons/web/static/src/js/fields/basic_fields.js') diff --git a/addons/web/static/src/js/fields/basic_fields.js b/addons/web/static/src/js/fields/basic_fields.js index 1b495696808..13148e62019 100644 --- a/addons/web/static/src/js/fields/basic_fields.js +++ b/addons/web/static/src/js/fields/basic_fields.js @@ -3666,6 +3666,9 @@ var FieldColorPicker = FieldInteger.extend({ } }, + _onNavigationMove() { + // disable navigation from FieldInput, to prevent a crash + } }); return { -- cgit v1.2.3