Skip to content

Web chorded pointer events do not properly send MouseInput events #2455

@DouglasDwyer

Description

@DouglasDwyer

This issue concerns the fact that chorded pointer events (for example, pressing the left and then right mouse buttons at the same time) do not work correctly on the web.

On the web, Winit supports both MouseEvents and PointerEvents. Both of these are implemented as simple callbacks on top of the browser canvas's event API. When a mousedown or pointerdown event is fired, Winit reports a MouseInput event. The same occurs for mouse button release. However, the pointer events specification stipulates that pointerdown/pointerup events are only ever sent for the first/last mouse button that is pressed. This leads to the problems described in this StackOverflow answer, where Winit misses intermediate input events during the window when a mouse button is held. This issue is reproducible, in the same manner as the StackOverflow article, with the Winit web example. Things work correctly with MouseEvents rather than PointerEvents.

For now, a workaround is to use MouseEvents instead, but a more permanent solution would be nice. The appropriate way to implement this behavior on top of PointerEvents would be to respond to the pointerrawupdate or pointermove event, which are fired when mouse button state changes. Such an implementation would need to internally track whether the mouse buttons are currently held in order to determine when they change.

Metadata

Metadata

Assignees

No one assigned

    Labels

    B - bugDang, that shouldn't have happenedDS - webAffects the Web backend (WebAssembly/WASM)H - help wantedSomeone please save usS - platform parityUnintended platform differences

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions