[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) <boi@odoo.com>
This commit is contained in:
fdardenne
2022-11-30 15:06:00 +01:00
parent edd296da29
commit 1182fdebf7
@@ -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;
}