Skip to content

Commit

Permalink
[FIX] web: improve the hit box of the kanban quick_create
Browse files Browse the repository at this point in the history
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#61763

X-original-commit: 72ed824
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
Signed-off-by: awa-odoo <awa-odoo@users.noreply.github.com>
  • Loading branch information
awa-odoo committed Nov 16, 2020
1 parent c767ed9 commit 46cc27c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
13 changes: 12 additions & 1 deletion addons/web/static/tests/views/kanban_tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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();
});

Expand Down

0 comments on commit 46cc27c

Please sign in to comment.