a more robust check

This commit is contained in:
zsviczian
2025-08-20 19:36:26 +02:00
committed by GitHub
parent 42fe6c2632
commit 19a5e0bf86

View File

@@ -11159,10 +11159,20 @@ class App extends React.Component<AppProps, AppState> {
event: WheelEvent | React.WheelEvent<HTMLDivElement | HTMLCanvasElement>,
) => {
// if not scrolling on canvas/wysiwyg, ignore
const path = (event as any).composedPath?.() as EventTarget[] | undefined;
const isOnExcalidrawCanvas =
path?.some(
(n) =>
n instanceof HTMLCanvasElement &&
n.classList?.contains("excalidraw__canvas"),
) ||
(event.target as Element | null)?.closest?.(
"canvas.excalidraw__canvas",
) != null;
if (
!(
(event.target instanceof HTMLCanvasElement &&
event.target.classList.contains("excalidraw__canvas")) ||
isOnExcalidrawCanvas ||
event.target instanceof HTMLTextAreaElement ||
event.target instanceof HTMLIFrameElement
)