Skip to content
This repository was archived by the owner on Mar 23, 2026. It is now read-only.
This repository was archived by the owner on Mar 23, 2026. It is now read-only.

Rename relatedTarget to something like nextFocus? #34

Closed

Description

@hugoholgersson

DOM Events already have two attributes that are named *target*; currentTarget and target.

Let's not add a third one? To me, and maybe to others who are not fluent in JavaScript, this is a bit confusing.

Readers shouldn't need to go check the spec to get an idea of what the code does.

Activity

  1. frivoal commented on Feb 21, 2018

    @frivoal
    Collaborator

    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):

    HTML does the same:

    • 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.

  2. hugoholgersson commented on Feb 21, 2018

    @hugoholgersson
    Author

    Right ok. I didn't know relatedTarget was used that extensively already.

  3. frivoal commented on Feb 21, 2018

    @frivoal
    Collaborator

    Neither did I :) I had seen it here and there, but I had not checked whether it was universal. Looks like it is.

  4. added
    type:bug
    closed:rejected
    on Apr 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    closed:rejectedtopic:spectype:bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions