CalendarOwner: Bind a listener to mousewheel and stop it from bubbling, otherwise scrolling results scrolls the sidemenu

This commit is contained in:
nathan 2022-09-21 08:49:08 -06:00
parent 8cc14a9919
commit e8e1077ece

View File

@ -38,6 +38,20 @@ export class CalendarOwner extends Et2Select
super(...args);
this.searchUrl = "calendar_owner_etemplate_widget::ajax_search";
this.multiple = true;
this._handleMouseWheel = this._handleMouseWheel.bind(this);
}
_bindListeners()
{
super._bindListeners();
this.addEventListener("mousewheel", this._handleMouseWheel);
}
_unbindListeners()
{
this.removeEventListener("mousewheel", this._handleMouseWheel);
}
/**
@ -92,6 +106,16 @@ export class CalendarOwner extends Et2Select
});
}
/**
* Stop scroll from bubbling so the sidemenu doesn't scroll too
*
* @param {MouseEvent} e
*/
_handleMouseWheel(e : MouseEvent)
{
e.stopPropagation();
}
/**
* Check if a free entry value is acceptable.
* We only check the free entry, since value can be mixed.