Skip to content

Instantly share code, notes, and snippets.

@nextend
Last active March 6, 2019 06:54
Show Gist options
  • Save nextend/20099e318c02b5fc38c82e3ee71e0cb6 to your computer and use it in GitHub Desktop.
Save nextend/20099e318c02b5fc38c82e3ee71e0cb6 to your computer and use it in GitHub Desktop.

@edit: the original posts markdown is messed up

Here is the official documentation how PTP Pointer events should work in Edge: https://blogs.windows.com/msedgedev/2017/12/07/better-precision-touchpad-experience-ptp-pointer-events/

The example in the article - touch-action: none;

<canvas height=400 width=400 id="canvas" style="touch-action: none;"></canvas>
document.getElementById('canvas').addEventListener('pointermove', function(event) {
  console.log('pointermove!');
});

Touchscreen

When I swipe vertically on the area, the page won’t scroll away. <-- works as expected When I swipe horizontally on the area, the page is not going back and forward <-- works as expected

Precision Touchpad (PTP)

When I swipe vertically on the area, the page won’t scroll away. <-- works as expected When I swipe horizontally on the area, the page is not going back and forward <-- works as expected

touch-action: pan-y;

<canvas height=400 width=400 id="canvas" style="touch-action: pan-y;"></canvas>
document.getElementById('canvas').addEventListener('pointermove', function(event) {
  console.log('pointermove!');
});

Touchscreen

When I swipe vertically on the area, the page scroll away. <-- ==works as expected== When I swipe horizontally on the area, the page shouldn't go back and forward <-- ==works as expected==

Precision Touchpad (PTP)

When I swipe vertically on the area, the page scroll away. <-- ==works as expected== When I swipe horizontally on the area, the page goes back and forward <-- ==ERROR: touch-action: pan-y means that only that action is allowed to the browser and other actions handled by the website.==

touch-action: pan-x;

<canvas height=400 width=400 id="canvas" style="touch-action: pan-x;"></canvas>
document.getElementById('canvas').addEventListener('pointermove', function(event) {
  console.log('pointermove!');
});

Touchscreen

When I swipe vertically on the area, the page won’t scroll away. <-- ==works as expected== When I swipe horizontally on the area, the page goes back and forward <-- ==works as expected==

Precision Touchpad (PTP)

When I swipe vertically on the area, the page scroll away. <-- ==ERROR: the page shouldn’t scroll away== When I swipe horizontally on the area, the page goes back and forward <-- ==works as expected==

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment