One feature I'm trying to implement in my app is the ability to click on an item, such as changing the background color or text, and have a modal pop up with a color picker to customize the color of that specific item. However, I've run into an issue where my onClick
handler for the parent element triggers even when other elements within it are clicked.
If you take a look at the example I created using Chakra-ui in Codesandbox, you'll notice that clicking anywhere activates the color picker, whereas I want it to only appear when clicking the background.
This is part of the code snippet I'm working with:
const Navbar = () => {
// Code here...
};
At this point, I'm wondering if there's a way to restrict the color picker to show only when the background is clicked. If you'd like to see the live version of the app, it's also hosted on Netlify. Additionally, feel free to check out the complete codebase on GitHub.