Engrain by ByteRush

WEB.03.01 JuniorCore — asked often

Capture, target and bubble phases

Comes up in: Web fundamentals, JavaScript, Recruiter screen

This concept is being written. It gets the full five steps — explanation, predict, interview angle, practice with tests, and review cards. Here is exactly what it will cover, so you can study it elsewhere in the meantime.

What it covers

  • the three phases
  • addEventListener options (capture, once, passive, signal)
  • stopPropagation vs stopImmediatePropagation vs preventDefault
  • events that do not bubble (focus/blur vs focusin/focusout)
  • composedPath

Words you will know

event propagationcapture phasebubble phaseevent target

What you will practise

  • predict handler order in nested elements

Interview questions this answers

  • Explain event bubbling and capturing.
  • What is the difference between stopPropagation and preventDefault?
  • Which events do not bubble?
  • How does React handle events under the hood?