Skip to content

Commit

Permalink
safari issue
Browse files Browse the repository at this point in the history
  • Loading branch information
greggman committed Sep 10, 2023
1 parent 1a16ebb commit 419920f
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 4 deletions.
22 changes: 22 additions & 0 deletions test/prevent-scroll/inner.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<style>
html, body {
margin: 0;
height: 100%;
}
iframe {
border: none;
width: 100%;
height: 100%;
display: block;
}
</style>
</head>
<body>
<iframe src="touch events vs pointer events.html"></iframe>
</body>
</html>
22 changes: 22 additions & 0 deletions test/prevent-scroll/outer-broken.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<style>
html, body {
margin: 0;
height: 100%;
}
iframe {
border: none;
width: 100%;
height: 100%;
display: block;
}
</style>
</head>
<body>
<iframe src="inner.html"></iframe>
</body>
</html>
20 changes: 20 additions & 0 deletions test/prevent-scroll/outer-works-kinda.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!DOCTYPE html>
<html>
<head>
<style>
html, body {
margin: 0;
height: 100%;
}
iframe {
border: none;
width: 100%;
height: 100%;
display: block;
}
</style>
</head>
<body>
<iframe src="inner.html"></iframe>
</body>
</html>
8 changes: 4 additions & 4 deletions test/prevent-scroll/touch events vs pointer events.html
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@
function onTouchEnd() {
console.log('touchEnd');
window.removeEventListener('touchmove', onTouchMove);
window.removeEventListener('touchend', onTouchEnd)
window.removeEventListener('touchend', onTouchEnd);
}

function onTouchStart(e) {
Expand All @@ -143,7 +143,7 @@
elemStartY = parseInt(touchElem.style.top);

window.addEventListener('touchmove', onTouchMove, {passive: false});
window.addEventListener('touchend', onTouchEnd)
window.addEventListener('touchend', onTouchEnd);
}
touchElem.addEventListener('touchstart', onTouchStart, {passive: false});
}
Expand All @@ -170,7 +170,7 @@
function onPointerUp() {
console.log('pointerUp');
window.removeEventListener('pointermove', onPointerMove);
window.removeEventListener('pointerup', onPointerUp)
window.removeEventListener('pointerup', onPointerUp);
}

function onPointerDown(e) {
Expand All @@ -183,7 +183,7 @@
elemStartY = parseInt(pointerElem.style.top);

window.addEventListener('pointermove', onPointerMove, {passive: false});
window.addEventListener('pointerup', onPointerUp)
window.addEventListener('pointerup', onPointerUp);
}
pointerElem.addEventListener('pointerdown', onPointerDown, {passive: false});
}
Expand Down

0 comments on commit 419920f

Please sign in to comment.