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.

add pointerDown, pointerMove and pointerUp events for API

See original GitHub issue

I think it would be beneficial to have pointerDown, pointerMove, and pointerUp user events so you can encapsulate touch events, mouse events, pointer events all under one API.

The reason why I think something like this should exist is it would allow for testing complex UI components like a slider input.

the basic implementation I think could work from a high level is the following:

const input = document.getElementById('input');
// you could use a percent to represent the bounds of the element
// or use a specific number to represent a pixel value
userEvent.pointerDown(input, {x: '50%', y: '50%'}); // starting point of where you "clicked"
userEvent.pointerMove(input, {x: '75%', y: '50%', duration: '1s'}); // where you want to move to over a period of time
userEvent.pointerUp(input); // remove your finger from the screen/mouse/etc

@kentcdodds what do you think?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
kentcdoddscommented, Apr 2, 2021

Personally I’d just use cypress. JSDOM doesn’t support layout so you’d have to mock that out of you wanted to do it in that environment…

0reactions
allcontributors[bot]commented, Mar 3, 2022

@ph-fritsche

I’ve put up a pull request to add @lifeiscontent! 🎉

Read more comments on GitHub >

github_iconTop Results From Across the Web

Pointer events - Web APIs | MDN
The events needed to handle generic pointer input are analogous to mouse events ( mousedown / pointerdown , mousemove / pointermove , etc.)....
Read more >
The HTML5 Pointer Events API: Combining touch, mouse, and ...
The Pointer Events API combines touch, mouse, pen and other inputs into a single unified ... Add an event handler for the pointerdown...
Read more >
Pointer events - The Modern JavaScript Tutorial
When the user moves and then removes a finger, we get pointermove and pointerup events with the same pointerId as we had in...
Read more >
Pointer Events - W3C
If the event is pointerdown , pointermove , or pointerup set active ... A pointerrawupdate listener should only be added if JavaScript needs ......
Read more >
Pointer events API inconsistency - javascript - Stack Overflow
Pointer Events do not fire overlapping pointerdown and pointerup events for ... of the state if you read buttons out of e.g. pointermove...
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