From 1182fdebf7d4ba4e57a21454cd8fa423ee7bda26 Mon Sep 17 00:00:00 2001 From: fdardenne Date: Thu, 24 Nov 2022 08:08:48 +0000 Subject: [PATCH] [FIX] web: list: fix focus function for checkboxes The input element properties `selectionStart` and `selectionEnd` method applies only to inputs of types `text`, `search`, `URL`, `tel` and `password`. This specification is interpreted differently depending on the browser: Accessing those properties in a `checkbox` input results in a crash in Safari but not in Chrome/Firefox. Current behaviour: In a list view, in safari, press the arrowdown key -> it causes a crash Expected behaviour: Pressing the arrowdown key causes the next checkbox to be focused. closes odoo/odoo#99050 Related: odoo/enterprise#34101 Signed-off-by: Bruno Boi (boi) --- addons/web/static/src/views/list/list_renderer.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/web/static/src/views/list/list_renderer.js b/addons/web/static/src/views/list/list_renderer.js index 2616fcb90e3..555e8618e2c 100644 --- a/addons/web/static/src/views/list/list_renderer.js +++ b/addons/web/static/src/views/list/list_renderer.js @@ -405,7 +405,7 @@ export class ListRenderer extends Component { focus(el) { el.focus(); - if (["INPUT", "TEXTAREA"].includes(el.tagName)) { + if (["text", "search", "URL", "tel", "password", "textarea"].includes(el.type)) { if (el.selectionStart === null) { return; }