[FIX] web: less bounce edit form button

Before this commit, the edit button in form view bounced on any click.
Now, the button bounces only when clicking in the area of a field or its label.

closes odoo/odoo#96784

Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
This commit is contained in:
Michael (mcm)
2022-08-04 18:35:29 +02:00
parent 2720bc2034
commit b3bc5a0a03
2 changed files with 8 additions and 2 deletions
@@ -31,8 +31,8 @@ export class FormRenderer extends Component {
this.compileParams
);
useSubEnv({ model: record.model });
useBounceButton(useRef("compiled_view_root"), () => {
return !record.isInEdition;
useBounceButton(useRef("compiled_view_root"), (target) => {
return !record.isInEdition && !!target.closest(".oe_title, .o_inner_group");
});
this.uiService = useService('ui');
this.onResize = useDebounced(this.render, 200);
@@ -9131,11 +9131,17 @@ QUnit.module("Views", (hooks) => {
<div class="oe_title">
<field name="display_name"/>
</div>
<notebook>
<page name="a" string="A"></page>
</notebook>
</form>`,
resId: 1,
});
// in readonly
await click(target.querySelector(".nav-tabs .nav-item"));
assert.containsNone(target, ".o_catch_attention");
await click(target.querySelector("div.oe_title"));
assert.hasClass(target.querySelector(".o_form_button_edit"), "o_catch_attention");