#880: Extending the PointerEvent with Unique DeviceId Attribute

Visit on Github.

Opened Jul 28, 2023

こんにちは TAG-さん!

I'm requesting a TAG review of PointerEvent.deviceId.

As devices with advanced pen input capabilities are becoming increasingly prevalent, it is important that the web platform continues to evolve to fully support these advanced features in order to unlock rich experiences for both end users and developers. One such advancement is the ability for a device's digitizer to recognize more than one pen device interacting with it simultaneously. In this Explainer, we propose an extension to the PointerEvent interface to include a new attribute, deviceId, that represents a session-persistent, document isolated, unique identifier that a developer can reliably use to identify individual pens interacting with the page.

Further details:

  • I have reviewed the TAG's Web Platform Design Principles
  • Relevant time constraints or deadlines: Dec 2023
  • The group where the work on this specification is currently being done: Web Incubation Community Group (WICG)
  • The group where standardization of this work is intended to be done (if current group is a community group or other incubation venue): PointerEvent Working Group
  • Major unresolved issues with or opposition to this specification: No opposition or issues
  • This work is being funded by: Microsoft

We'd prefer the TAG provide feedback as (please delete all but the desired option):

💬 leave review feedback as a comment in this issue and @-notify [github usernames]


Discussions

Comment by @sahirv Jul 28, 2023 (See Github)
  1. What information does this feature expose, and for what purposes? It exposes a mapped device id of pen devices in a pointer event, for the purpose of identifying that hardware for the document session. A use case is multi-pen input on one device at the same time, and assigning a different color to each pen.
  2. Do features in your specification expose the minimum amount of information necessary to implement the intended functionality? Yes
  3. Do the features in your specification expose personal information, personally-identifiable information (PII), or information derived from either? No personal information or PII is exposed, only the fact that a user is using a pen device and how many pens they use.
  4. How do the features in your specification deal with sensitive information? Sensitive information like the hardware id are not exposed.
  5. Do the features in your specification introduce state that persists across browsing sessions? No.
  6. Do the features in your specification expose information about the underlying platform to origins? No.
  7. Does this specification allow an origin to send data to the underlying platform? No.
  8. Do features in this specification enable access to device sensors? No.
  9. Do features in this specification enable new script execution/loading mechanisms? No.
  10. Do features in this specification allow an origin to access other devices? No.
  11. Do features in this specification allow an origin some measure of control over a user agent's native UI? No.
  12. What temporary identifiers do the features in this specification create or expose to the web? A device id.
  13. How does this specification distinguish between behavior in first-party and third-party contexts? Same as pointer events.
  14. How do the features in this specification work in the context of a browser’s Private Browsing or Incognito mode? No change.
  15. Does this specification have both "Security Considerations" and "Privacy Considerations" sections? Yes.
  16. Do features in your specification enable origins to downgrade default security protections? No.
  17. What happens when a document that uses your feature is kept alive in BFCache instead of getting destroyed) after navigation, and potentially gets reused on future navigations back to the document? The device Id's would not be reset; in chromium they are assigned a value from 2 onwards, with the first device to interact getting 2.
  18. What happens when a document that uses your feature gets disconnected? No change.
  19. What should this questionnaire have asked?
Discussed Oct 9, 2023 (See Github)

bumped to next week

Discussed Oct 16, 2023 (See Github)

Dan: not concerned about persistent device IDs... because it's session scoped.

Rossen: is this part of webapps? Why are they starting with WICG?

Peter: explainer says the expected venue is WICG...

Rossen: pointer events - where is it?

Peter: not sure where current status is....

Peter: pointer events wg still exists and charter expires end of this month...

Dan: the design?

Rossen: the motivation makes total sense –being able to recognize multiple input devices in a session - makes a lot of sense. Pen... gaze... other ways of interacting... The thing that I'm trying to get from the use case...

we look at the example provided in the explainer

Rossen: so it's really just a device id and nothing else - no additional context - you can't treat the input differently...

Dan: you wouldn't be able to determine if a given device is a pen, etc...

Rossen: no - so if you resume editing of the same document you wouldn't get the same context...

Dan: IDs are ephemeral...

Rossen: so if session restarts your colors assigned might swap...

Rossen: in your session - in this use cases - you would have a device and a color ... mapping. That's all the context you have. 1 = blue, 2 = red. No guarantee when you resume your session that device 1 will be the same device you had before...

Peter: minor concern - on difference between pointer ID and device ID. "if the device doesn't support hardware ID then you have a new ID for every event..." And we also have interfaces on element... Just curious about how those values interact. Wondering about the difference between device ID and pointer ID... in the cases where the device does not have a hardware ID... then device ID would always be -1 and pointer ID would be incrementing value... But if it does have a hardware ID then PointerID would be stable... So (a) is pointer ID and device ID ever going to be the same and (b) why is't pointer ID just a flag saying the device ID is stable? So if you have multiple pens (e.g.) with no hardware IDs then they would all be listed as -1 ... so would this even be useful for devices without a hardware ID?

<blockquote> Hi @sahirv - thanks for sending this our way. We discussed in our call today

The motiviation (user need) seems to make sense.

We wanted to clarify - it seems there is no way to persist device IDs across sessions with the current design. In your example, if your session is interupted your color assigned to each device might swap. Is that the intention?

We're also concerned about the usefulness of this for devices that don't have a hardware ID - since it seems they wouldn't be able to be differentiated within a session?

For devices with a hardware ID, would the deviceId be the same as the pointerId? If so, maybe this could just be a flag indicating that the pointerId is stable? If not, why not?

Also can you clarify where this work will end up for standardization. It seems that this belongs in the Pointer Events Working Group - but that group is due to close off in a month. Is the intention to open up this group again for further updates, or do you envision bringing this to WebApps or some other working group?

</blockquote>
Comment by @torgo Oct 16, 2023 (See Github)

Hi @sahirv - thanks for sending this our way. We discussed in our call today

The motivation (user need) seems to make sense.

We wanted to clarify - it seems there is no way to persist device IDs across sessions with the current design. In your example, if your session is interrupted your color assigned to each device might swap. Is that the intention?

We're also concerned about the usefulness of this for devices that don't have a hardware ID - since it seems they wouldn't be able to be differentiated within a session?

For devices with a hardware ID, would the deviceId be the same as the pointerId? If so, maybe this could just be a flag indicating that the pointerId is stable? If not, why not?

Also can you clarify where this work will end up for standardization. It seems that this belongs in the Pointer Events Working Group - but that group is due to close off in a month. Is the intention to open up this group again for further updates, or do you envision bringing this to WebApps or some other working group?

Comment by @sahirv Oct 25, 2023 (See Github)

Thanks for your response!

We wanted to clarify - it seems there is no way to persist device IDs across sessions with the current design. In your example, if your session is interrupted your color assigned to each device might swap. Is that the intention? Yes in the current design, the device id does not persist across sessions, only through the session. Persisting the device id across sessions would introduce some further questions - such as how long to keep the device id, preventing fingerprinting (if for example multiple people use one browser with their own pens).

We're also concerned about the usefulness of this for devices that don't have a hardware ID - since it seems they wouldn't be able to be differentiated within a session? Devices with no hardware ID will not have a device id in the current design. Perhaps in lieu of the hardware ID itself, we can use other features that the device has implemented to differentiate itself from other devices. If there is no such feature in the device, then the device ID can't work by nature.

For devices with a hardware ID, would the deviceId be the same as the pointerId? If so, maybe this could just be a flag indicating that the pointerId is stable? If not, why not? We considered repurposing pointer id as the device id. However, the main issue we ran into was that in some instances, the physical device does not provide a hardware id. An example is the surface pen on the pointer down. When creating the PointerDown event, the browser needs to have a pointerId. For the subsequent PointerMove, a device Id is present, but the pointerId can't change for the stroke. Therefore, it makes sense to have the two separate values to indicate the state.

Also can you clarify where this work will end up for standardization. It seems that this belongs in the Pointer Events Working Group - but that group is due to close off in a month. Is the intention to open up this group again for further updates, or do you envision bringing this to WebApps or some other working group? We're currently going through the WICG and will work on an extension spec. I'm not quite sure which WG will end up owning the Pointer Events/Events space, but we are happy to work with anyone willing to take this on.

Discussed Dec 18, 2023 (See Github)

We had a question, Lea left a comment. Could be ready to close. Marked "propose closing".

Comment by @LeaVerou Dec 18, 2023 (See Github)

Hi there, quick question: Does the device id of the same device persist within the same session if the device disconnects and reconnects? We were just discussing that the user expectation is likely that it would.

Comment by @sahirv Dec 19, 2023 (See Github)

Yes if the device re-connects to the same session, it will and should have the same deviceId.

Comment by @LeaVerou Dec 20, 2023 (See Github)

Sounds good. That was our only concern, so we're happy to see this moving forwards. Thanks for flying TAG!