From 53e87868fa4deba26c67ba2d6d9690864853f9ec Mon Sep 17 00:00:00 2001 From: Alexander Zinchuk Date: Mon, 27 Jun 2022 22:02:47 +0200 Subject: [PATCH] Media Viewer: Fix scrolling caption (#1916) --- src/util/captureEvents.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/util/captureEvents.ts b/src/util/captureEvents.ts index dd4dca7fc..36be0c80f 100644 --- a/src/util/captureEvents.ts +++ b/src/util/captureEvents.ts @@ -321,6 +321,12 @@ export function captureEvents(element: HTMLElement, options: CaptureOptions) { function onWheel(e: WheelEvent) { if (!options.onZoom && !options.onDrag) return; + if (options.excludedClosestSelector && ( + (e.target as HTMLElement).matches(options.excludedClosestSelector) + || (e.target as HTMLElement).closest(options.excludedClosestSelector) + )) { + return; + } e.preventDefault(); e.stopPropagation(); if (!hasMoved) {