From e8e1077ece389691228204569df3db8b3a1bba68 Mon Sep 17 00:00:00 2001 From: nathan Date: Wed, 21 Sep 2022 08:49:08 -0600 Subject: [PATCH] CalendarOwner: Bind a listener to mousewheel and stop it from bubbling, otherwise scrolling results scrolls the sidemenu --- calendar/js/CalendarOwner.ts | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/calendar/js/CalendarOwner.ts b/calendar/js/CalendarOwner.ts index b85a9d5b69..b7b3387b27 100644 --- a/calendar/js/CalendarOwner.ts +++ b/calendar/js/CalendarOwner.ts @@ -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.