casesandberg / casesandberg/react-color

How to stop event propagation?

Open
#705 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
12.3k
Forks
920
PR merge metrics
No merged PRs in 30d

Description

Hello! Thanks for a great package.

I'm wondering if there is a way to stop event propagation on inputs?

I have `document.addEventListener` in my application, which deletes items on `DEL` etc. In all my other inputs I do the following to prevent this behavior when modifying input:
` event.stopPropagation();`
`event.nativeEvent.stopPropagation();`
`event.nativeEvent.stopImmediatePropagation();`

I briefly looked through the code, and it doesn't seem like you pass the event to `onChange`?
`onChange?: ColorChangeHandler;`
`export type ColorChangeHandler = (color: ColorResult) => void;`

How do I achieve what I want? Here is a [codesandbox](https://codesandbox.io/s/laughing-kalam-5r09c?file=/src/App.js) reproducing my issue.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.