[FIX] web: improve the hit box of the kanban quick_create

When the user clicks outside of the kanban quick create element, it's closing
itself automatically.

However, the "hit box" of this behavior is not entirely accurate and clicking
on the very edge of the box would also close the element.

This commit fixes the click behavior and allows clicking anywhere inside the
quick create element.

Task 2373095

closes odoo/odoo#61763

X-original-commit: 72ed82489daa2b82628dfdefeb06262e17e6548e
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: awa-odoo <awa-odoo@users.noreply.github.com>
This commit is contained in:
Aurélien Warnon
2020-11-16 09:58:10 +00:00
parent c767ed9380
commit 46cc27cc6e
2 changed files with 13 additions and 2 deletions
@@ -283,7 +283,7 @@ var RecordQuickCreate = Widget.extend({
}
// ignore clicks if target is inside the quick create
if (this.el.contains(ev.target) && this.el !== ev.target) {
if (this.el.contains(ev.target) || this.el === ev.target) {
return;
}
+12 -1
View File
@@ -1405,7 +1405,7 @@ QUnit.module('Views', {
});
QUnit.test('quick create record: cancel when not dirty', async function (assert) {
assert.expect(9);
assert.expect(11);
var kanban = await createView({
View: KanbanView,
@@ -1464,6 +1464,17 @@ QUnit.module('Views', {
assert.containsOnce(kanban, '.o_kanban_group:first .o_kanban_record',
"first column should still contain one record");
// click to reopen the quick create
await testUtils.dom.click(kanban.$('.o_kanban_header .o_kanban_quick_add i').first());
assert.containsOnce(kanban, '.o_kanban_quick_create',
"should have open the quick create widget");
// clicking on the quick create itself should keep it open
await testUtils.dom.click(kanban.$('.o_kanban_quick_create'));
assert.containsOnce(kanban, '.o_kanban_quick_create',
"the quick create should not have been destroyed when clicked on itself");
kanban.destroy();
});