Skip to main content
JavaScript Interview Questions Concept Queue P0 Medium

Clicking an icon does nothing

A list uses one parent click listener. Its handler checks whether event.target matches button[data-row-id]. Clicking button text works, but clicking the SVG icon inside the same button does not. Explain the bug and propose a fix that also works when new rows are appended.

Official Reference

Model Answer & Explanation

event.target may be a descendant like the SVG, while event.currentTarget is the parent with the delegated listener. For an Element target, use closest('button[data-row-id]'), then check that the matched button belongs to the intended parent. The same parent listener handles new rows through bubbling.

What a Strong Answer Covers

  • Distinguish the original event target from the listener’s element.
  • Find the nearest matching button and check its boundary.
Follow-up Interview Question · Why would stopping propagation in a nested widget affect this delegation?

Module Context & References

JavaScript · Applied concepts Debug real scenarios and explain the rule behind each fix.
Personal Notes · Markdown

Technologies & Interview Topics Covered

Switch between short-term interview tracks and long-term 80/20 engineering depth to practice JavaScript internals, React rendering and hooks, timed frontend machine coding UI challenges, MeetaPro FG300, Blind 75 & NeetCode 150 DSA patterns, Python & FastAPI APIs, PostgreSQL query optimization & MVCC, Redis caching, Applied AI RAG pipelines & evaluations, and distributed system design.