diff --git a/addons/web/static/src/core/checkbox/checkbox.js b/addons/web/static/src/core/checkbox/checkbox.js index 9f394c0555e..86f11314c24 100644 --- a/addons/web/static/src/core/checkbox/checkbox.js +++ b/addons/web/static/src/core/checkbox/checkbox.js @@ -38,6 +38,7 @@ export class CheckBox extends Component { onClick(ev) { if (ev.composedPath().find((el) => ["INPUT", "LABEL"].includes(el.tagName))) { // The onChange will handle these cases. + ev.stopPropagation(); return; } @@ -45,6 +46,7 @@ export class CheckBox extends Component { const input = this.rootRef.el.querySelector("input"); input.focus(); if (!this.props.disabled) { + ev.stopPropagation(); input.checked = !input.checked; } this.props.onChange(input.checked); diff --git a/addons/web/static/src/core/checkbox/checkbox.xml b/addons/web/static/src/core/checkbox/checkbox.xml index 5f25a60020e..7ab3fd02cd4 100644 --- a/addons/web/static/src/core/checkbox/checkbox.xml +++ b/addons/web/static/src/core/checkbox/checkbox.xml @@ -2,7 +2,7 @@ -
+
{ cell.querySelector(".o-checkbox input:checked").disabled, "input should be disabled in readonly mode" ); + await click(cell, ".o-checkbox"); + assert.hasClass( + document.querySelector("tr.o_data_row:nth-child(1)"), + "o_selected_row", + "the row is now selected, in edition" + ); + assert.ok( + !cell.querySelector(".o-checkbox input:checked").disabled, + "input should now be enabled" + ); await click(cell); assert.notOk( cell.querySelector(".o-checkbox input:checked").disabled,