You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 23, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Mar 23, 2026. It is now read-only.
Rename relatedTarget to something like nextFocus? #34
relatedTarget is actually also introduced by DOM, which does not give it any particular semantic, but does define how it should be handled so that the right thing happens when crossing shadow DOM boundaries.
So, relatedTarget is what various UI-Events use as an attribute name when they need something like this. Examples (in some of these, it is set to null):
DragEvent: dragstart, drag, dragenter, dragexit, dragleave, dragover, drop, and dragend
It actually goes a bit farther, and as far as I can tell, there is no event in any spec (I have checked DOM, UI-Events, HTML, CSSOM-View, css-transitions, css-animations, ServiceWorkers, Fetch, and Input Events) that has an additional attribute of type EventTarget called anything other than relatedTarget.
So yeah, I sympathize that this is not a terribly descriptive name, but it does seem to be the conventional way to handle this kind of information.
Activity
frivoal commentedon Feb 21, 2018
relatedTargetis actually also introduced by DOM, which does not give it any particular semantic, but does define how it should be handled so that the right thing happens when crossing shadow DOM boundaries.So,
relatedTargetis what various UI-Events use as an attribute name when they need something like this. Examples (in some of these, it is set tonull):HTML does the same:
It actually goes a bit farther, and as far as I can tell, there is no event in any spec (I have checked DOM, UI-Events, HTML, CSSOM-View, css-transitions, css-animations, ServiceWorkers, Fetch, and Input Events) that has an additional attribute of type EventTarget called anything other than
relatedTarget.So yeah, I sympathize that this is not a terribly descriptive name, but it does seem to be the conventional way to handle this kind of information.
hugoholgersson commentedon Feb 21, 2018
Right ok. I didn't know
relatedTargetwas used that extensively already.frivoal commentedon Feb 21, 2018
Neither did I :) I had seen it here and there, but I had not checked whether it was universal. Looks like it is.