PenEvents to enable rich pen scenarios on the web

This issue proposes additional pen events functionality on the web that was only available to native apps before.

As described in the explainer, some digital pens such as Surface Pen, come with a Bluetooth button that can dispatch an event to the system when the button is pressed on. This scenario is different from point events in that the tip of the pen doesn’t need to be in proximity or touching the screen.

In addition, there is hardware that comes with a dock that also dispatches docking event whenever pen is removed from it.

It is currently not possible to subscribe to these events on the web.

We propose a set of new pen events that can help developers build a more advanced UX workflows on the web.

Here are couple of examples of proposed API:

Would love to hear your feedback on this.

Explainer with full details:

Issues on github:

1 Like

Thanks @gked. I filed a request for a Mozilla position: https://github.com/mozilla/standards-positions/issues/190

These events seem awfully hardware specific. For the button events my first thought would be, why special events just for pens and not an extension to pointer events? If the button press happens while the stylus is down then it should clearly be a pointer event, so I guess the problem case is when the stylus is not touching the screen, but couldn’t there be some extension to pointer events to handle a location free case? This would help for future pointing devices that might at times not have a screen location.

At the very least, the Explainer should address “why not pointer events” and it doesn’t.

For the dock change event, does it affect anything other than specifically the Microsoft Surface with dockable stylus? I’m not aware of other similar hardware having behaviors like this. I think it might be too hardware-specific to be a web standard.

2 Likes

I know for Microsoft Office, we would definitely want to support PowerPoint on the web scenario of being able to advance your slides using your hardware pen tail/eraser button. Having a standard that we can use would be good.

I would like to see a dock API standard that could be created and whilst Surface Hub might be the first, I could see a Galaxy Note as a potential scenario as well.

I agree that we should describe “why not pointer events”!