[w3c/uievents] Define FocusEvent's relatedTarget in terms of the event's relatedTarget (Issue #425)

annevk created an issue (w3c/uievents#425)

DOM defines an [event's relatedTarget](https://dom.spec.whatwg.org/#event-relatedtarget). [Dispatch](https://dom.spec.whatwg.org/#concept-event-dispatch) uses it to retarget across shadow trees, to limit how far the event propagates, and to clear the value after dispatch. DOM notes that other specifications use it to define a `relatedTarget` attribute.

[`FocusEvent`](https://w3c.github.io/uievents/#interface-focusevent) doesn't make that connection. Its `relatedTarget` is a plain attribute, and the `relatedTarget` member of `FocusEventInit` only initializes that attribute. Nothing says the getter returns the event's relatedTarget, or that constructing a `FocusEvent` sets it. DOM's [event constructing steps](https://dom.spec.whatwg.org/#concept-event-constructor-ext) exist for the latter.

This matters more now. whatwg/dom#1353 adds a *relatedTarget* parameter to [fire an event](https://dom.spec.whatwg.org/#concept-event-fire) that sets the event's relatedTarget. whatwg/html#10995 uses that parameter for focus events instead of initializing the attribute.

Suggested fix:

- The `relatedTarget` getter steps return this's relatedTarget.
- `FocusEvent`'s event constructing steps set the event's relatedTarget to *eventInitDict*["`relatedTarget`"].

`MouseEvent` has the same gap. It is now defined in Pointer Events.


-- 
Reply to this email directly or view it on GitHub:
https://github.com/w3c/uievents/issues/425
You are receiving this because you are subscribed to this thread.

Message ID: <w3c/uievents/issues/425@github.com>

Received on Friday, 13 November 2026 15:56:18 UTC