[pointerevents] Are click events forwarded from `<label>` considered to be generated by a pointing device? (#554)

sb3nder has just created a new issue for https://github.com/w3c/pointerevents:

== Are click events forwarded from `<label>` considered to be generated by a pointing device? ==
The spec says:
>- If the events are generated by a pointing device, their <!---0.272262%--><a data-link-type="idl" data-xref-type="attribute|dict-member|const" data-link-for="PointerEvent" data-xref-for="PointerEvent" href="#dom-pointerevent-pointerid" class="internalDFN" id="ref-for-dom-pointerevent-pointerid-19"><code>pointerId<!---0.272262%--></code></a><!---0.272262%--> and <code>pointerType</code> <em class="rfc2119">MUST<!---0.272262%--></em> be the same as the PointerEvents that caused these events.
>- If the events are generated by a non-pointing device (such as voice recognition software or a keyboard interaction), <!---0.272262%--><a data-link-type="idl" data-xref-type="attribute|dict-member|const" data-link-for="PointerEvent" data-xref-for="PointerEvent" href="#dom-pointerevent-pointerid" class="internalDFN" id="ref-for-dom-pointerevent-pointerid-20"><code>pointerId<!---0.272262%--></code></a><!---0.272262%--> <em class="rfc2119">MUST<!---0.272262%--></em> be <code>-1</code> and <code>pointerType</code> <em class="rfc2119">MUST<!---0.272262%--></em> be an empty string.

Based on this, I would expect that if I click a `<label>` using a pointing device, the click event that is forwarded to the associated control would have the same `pointerType` and `pointerId`

Firefox behaves as I would expect.

In Chrome, however, the click event fired on the associated control has `pointerType: ""` and `pointerId: -1`.

If this is a bug, I'm happy to report it.

<details>

<summary>For now, I have a sort of workaround that covers some cases:</summary>

```js
document.addEventListener('click', (e) => {
 if (e.isTrusted) {
  const isFirefox = navigator.userAgent.indexOf("Firefox") > -1;

  console.log(e);
  console.log(`click: ${isFirefox ? 'Firefox' : 'Chrome'}`, { detail: e.detail, pointerType: e.pointerType, pointerId: e.pointerId, target: e.target, explicitOriginalTarget: e.explicitOriginalTarget, sourceCapabilities: e.sourceCapabilities });

  if (isFirefox) {
   // Firefox
   // pen pointerType don't work
   if (e.pointerId >= 0) {
    // originated from a user pointer click

    if (e.target.contains(e.explicitOriginalTarget)) {
     // user pointer click
     if (e.detail >= 1) {
      // normal
      console.log(`user ${e.pointerType}-pointer click`);
     }
     else if (e.detail === 0) {
      // when you click on a select option
      console.warn(`user strange ?${e.pointerType}-pointer click`);
     }
    } else {
     // from label click
     console.log(`from-label ${e.pointerType}-pointer click`);
    }
   } else if (e.pointerId === -1) {
    // user keyboard click
    console.log('user keyboard click');
   }
  } else {
   // Chrome
   if (e.sourceCapabilities !== null) {
    // originated from a user pointer click

    if (e.pointerId >= 0) {
     // user click
     if (e.detail >= 1) {
      // normal
      console.log(`user ${e.pointerType}-pointer click`);
     }
     else if (e.detail === 0) {
      // when you click on a select option
      console.warn(`user strange ?${e.pointerType}-pointer click`);
     }
    } else if (e.pointerId === -1) {
     // from label click
     console.log(`from-label ?${e.pointerType}-pointer click`);
    }
   }
   else if (e.pointerId === -1) {
    // user keyboard click
    console.log('user keyboard click');
   }
  }
 }
}, true);
```

</details>

---

**Another thing that may be relevant:**
In both Chrome and Firefox, interacting with a `<select>` fires click events with `detail: 0`, `pointerType: ""`, and `pointerId: 0` for both pointer and keyboard input.

Please view or discuss this issue at https://github.com/w3c/pointerevents/issues/554 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Thursday, 9 October 2025 15:37:57 UTC