@mocanvas/editor · function

stopEventPropagation

declare function stopEventPropagation(event: {
    stopPropagation(): void;
}): void

Stop an event travelling any further up the tree.

The canvas listens for pointer events on its container, so a click on a piece of chrome rendered over it — a toolbar button, a menu, a panel — would also start a canvas interaction. Hanging this on the chrome's root (onPointerDown={stopEventPropagation}) keeps the two apart.

Typed structurally rather than against React.SyntheticEvent so it can be handed to a native listener, a React handler, or a test double alike.

mocanvas is built by Symbio. Free for non-commercial, non-profit and development use; commercial use needs an agreement. Not affiliated with or endorsed by tldraw.