[FIX] web_editor: fix reset when triggering scroll
This commit fixes the behavior hiding the select element when scrolling has happened. Instead of the 'scroll' event, 'mousewheel' was used, which isn't triggered when scrolling on a touch device. Now, the correct event is used, and the listener is given to the actual document element, instead of being globally listening on window (in case of iframes). This fix is part of a bug happening in the report editor of Studio, since the select element wouldn't be reset when scrolling, but kept visible at the same outdated position. ticket-3496665 closes odoo/odoo#144178 X-original-commit: f53f8b2f2cba5e586dd376ddd7ec39a16741f66a Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
This commit is contained in:
@@ -194,8 +194,6 @@ export class QWebPlugin {
|
||||
);
|
||||
}
|
||||
_updateBranchingSelectionPosition(target) {
|
||||
window.addEventListener('mousewheel', this._hideBranchingSelection);
|
||||
|
||||
const box = target.getBoundingClientRect();
|
||||
const selBox = this._selectElWrapper.getBoundingClientRect();
|
||||
const parentBox = this._getContextFromParentRect();
|
||||
@@ -207,6 +205,7 @@ export class QWebPlugin {
|
||||
this._selectElWrapper.style.top = `${top}px`;
|
||||
}
|
||||
_renderBranchingSelection(target) {
|
||||
this._document.addEventListener('scroll', this._hideBranchingSelection);
|
||||
const selectEl = document.createElement('select');
|
||||
const groupId = parseInt(target.getAttribute('data-oe-t-group'));
|
||||
const groupElements = target.parentElement.querySelectorAll(
|
||||
@@ -244,6 +243,6 @@ export class QWebPlugin {
|
||||
_hideBranchingSelection() {
|
||||
this._selectElWrapper.style.display = 'none';
|
||||
this._selectElWrapper.innerHTML = ``;
|
||||
window.removeEventListener('mousewheel', this._hideBranchingSelection);
|
||||
this._document.removeEventListener('scroll', this._hideBranchingSelection);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user