eventLoopFocus()function

eventLoopFocus({ currentTarget, relatedTarget }: { currentTarget: Element; relatedTarget: Element | null }): void
ParamType
event{ currentTarget: Element; relatedTarget: Element
null }
The blur event, providing currentTarget (the container) and relatedTarget (the new focus target). required

Loop focus inside an element in response to a blur event — a ready-made onBlur handler that traps focus.

  • Pulls focus back to the first focusable child when it blurs outside the event's currentTarget.

Examples

<div onBlur={eventLoopFocus}>…</div>