focusin and focusout
The bubbling versions of the focus and blur events, which fire as focus moves into or out of an element and travel up to its ancestors.
In more detail
Each event's relatedTarget tells you where focus came from or is going. They make it possible to delegate focus handling, for example to highlight a whole form row when any field inside it is focused.
Related terms
- focus and blur events — Events fired when an element gains keyboard focus (focus) or loses it (blur); they do not bubble.
- event delegation — Handling events for many child elements with one listener on a shared ancestor, using event.target to find which child was involved.
Taught in
- Event Delegation: Memory-Efficient Interaction Handlers — Frontend Architecture & Web Platform