question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Mouse events not sending pointerId

See original GitHub issue

Current behavior:

Failed to execute 'setPointerCapture' on 'Element': No active pointer with the given id is found.

Desired behavior:

Element.hasPointerCapture() is not invoked by Cypress: https://developer.mozilla.org/en-US/docs/Web/API/Element/hasPointerCapture

Steps to reproduce: (app code and test code)

Use the code from: https://developer.mozilla.org/en-US/docs/Web/API/Element/setPointerCapture

We created 2 simple examples (attached as zips, see below):

  1. A slider object which uses pointer capture
  2. A canvas which uses pointer events to draw

Versions

Cypress: 3.4.0 - 3.6.1 OS: Win10 Browser: Chrome 78

Attachments

CanvasPointer.zip PointerCapture.zip

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:1
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
testorangemaccommented, Nov 13, 2019

We did find a solution (with the assumption Chrome always uses pointerId 1):

cy.get('#slider")
   .trigger("pointerdown", { pointerId: 1 })
   .trigger("pointermove", { clientX: 270 })
   .trigger("pointermove", { clientX: 150 })
   .trigger("pointerup", { pointerId: 1})
0reactions
connerleverettcommented, Apr 22, 2021

We did find a solution (with the assumption Chrome always uses pointerId 1):

cy.get('#slider")
   .trigger("pointerdown", { pointerId: 1 })
   .trigger("pointermove", { clientX: 270 })
   .trigger("pointermove", { clientX: 150 })
   .trigger("pointerup", { pointerId: 1})

I found that this didn’t work in Firefox. Changing the pointerId from 1 to 0 occasionally did but not always.

 cy.get('#slider")
    .trigger("pointerdown", { pointerId: 0 })
Read more comments on GitHub >

github_iconTop Results From Across the Web

PointerEvent.pointerId - Web APIs - MDN Web Docs
The pointerId read-only property of the PointerEvent interface is an identifier assigned to a given pointer event. The identifier is unique, ...
Read more >
javascript - How to get a pointerId from a MouseEvent for use ...
I can't use pointerdown events since those are the unsupported events. They contain a pointerId , but mouse events do not.
Read more >
Pointer Events - W3C
Publication as a Working Draft does not imply endorsement by W3C and ... a generic pointerId value of 0 or 1 for the...
Read more >
Pointer events - The Modern JavaScript Tutorial
Long ago, in the past, there were only mouse events. ... Please note: the pointerId is assigned not to the whole device, ...
Read more >
SyntheticEvent - React
The synthetic events are different from, and do not map directly to, ... Focus Events; Form Events; Generic Events; Mouse Events; Pointer Events...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found