[w3c/uievents] Proposal: use `relatedTarget` for click events originated from labels (Issue #402)

sb3nder created an issue (w3c/uievents#402)

When a `<label>` is clicked, the browser fires a direct click event on the label itself, followed by an indirect click event on the associated form control (e.g., `<input>`).

To distinguish label-initiated (indirect) clicks from direct clicks on the control, the `click` event would use the `relatedTarget` property to reference the label for indirect clicks.

This would enable more precise event handling without relying on timing-based workarounds or additional state.

It would be used like this:

```js
if (event.relatedTarget !== null)
    console.log('click from label');
```

Or like this, if there are other possible sources of indirect clicks on the control:

```js
if (Array.from(control.labels).includes(event.relatedTarget))
    console.log('click from label');
```

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

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

Received on Friday, 10 October 2025 22:58:06 UTC