[FIX] web: restore drag&drop in Firefox

Steps to reproduce
==================

- Go to a kanban view
- Drag a card by the title to another column
-> The record is opened instead of being moved

Cause of the issue
==================

The `.o_kanban_record_headings` elements have a `overflow: hidden` rule
There is a bug [0][1] in firefox from 17 years ago were the
mouse{enter,leave} events are not fired in that case.

Solution
========

The previous attempt [2] to fix the issue is not working (anymore ?)

Thanks to a comment in the issue, we know that we can call
`.preventDefault` on the mousedown event.

[0]: https://bugzilla.mozilla.org/show_bug.cgi?id=339293
[1]: https://bugzilla.mozilla.org/show_bug.cgi?id=1352061
[2]: https://github.com/odoo/odoo/pull/104128

opw-3120973
opw-3121312

closes odoo/odoo#110282

X-original-commit: 713026806fa712afd85cb2530006f0f880dfa240
Signed-off-by: Julien Mougenot (jum) <jum@odoo.com>
Signed-off-by: Hubert Van De Walle <huvw@odoo.com>
This commit is contained in:
Hubert Van de Walle (huvw)
2023-01-18 17:38:31 +01:00
parent 25d1209cf0
commit 38fbdec503
2 changed files with 9 additions and 10 deletions
@@ -413,6 +413,14 @@ export function makeDraggableHook(hookParams = {}) {
return;
}
// In FireFox: elements with `overflow: hidden` will prevent mouseenter and mouseleave
// events from firing on elements underneath them. This is the case when dragging a card
// by the `.o_kanban_record_headings` element. In such cases, we can prevent the default
// action on the mousedown event to allow mouse events to fire properly.
// https://bugzilla.mozilla.org/show_bug.cgi?id=1352061
// https://bugzilla.mozilla.org/show_bug.cgi?id=339293
ev.preventDefault();
ctx.currentContainer = ctx.ref.el;
ctx.currentElement = ev.target.closest(ctx.elementSelector);
@@ -1,14 +1,5 @@
.o_dragged {
position: fixed !important;
z-index: 1000 !important;
// In FireFox: elements with `overflow: hidden` will prevent mouseenter and mouseleave
// events from firing on elements underneath them. This is the case when dragging a card
// by the `.o_kanban_record_headings` element. In such cases, the pointer events are
// disabled to allow mouse events to fire properly.
// https://bugzilla.mozilla.org/show_bug.cgi?id=1352061
&,
* {
pointer-events: none;
}
pointer-events: none;
}