Why is the parent scroll event getting triggered , when scrolling inside child,

From what I know scroll event doesn’t get bubbled to the parent and only bubbles document itself then why parent scroll event is getting fired, import { useEffect, useRef } from "react"; import "./styles.css"; export default function App() { const refParent = useRef(null); const refChild = useRef(null); useEffect(() => { function handleParent() { console.log("Parent"); }… Read More Why is the parent scroll event getting triggered , when scrolling inside child,

How can I trigger a function only when only child divs are clicked using event bubble?

const handleMenu = e => { console.log(e.target); e.stopPropagation(); } I want to console the event when a child div is clicked. for example: <div onclick={handleMenu}> <button>My orders</button> <button>Payment</button> </div> So, I want to trigger the handleMenu function only when those buttons are clicked and not to trigger when the area of parent div is getting… Read More How can I trigger a function only when only child divs are clicked using event bubble?