Skip to content

Commit eb8c9cb

Browse files
committed
fix drawer scroll
1 parent fd82c06 commit eb8c9cb

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

packages/ui-default/components/navigation/navigation.page.js

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,21 +116,34 @@ const navigationPage = new AutoloadPage('navigationPage', () => {
116116

117117
// Touch swipe support
118118
let touchStartX = 0;
119+
let touchStartY = 0;
119120
let touchCurrentX = 0;
120121
let isSwiping = false;
122+
let isScrolling = false;
121123

122124
panel.addEventListener('touchstart', (e) => {
123125
if (e.target.closest('[data-slideout-ignore]')) return;
124126
touchStartX = e.touches[0].clientX;
127+
touchStartY = e.touches[0].clientY;
125128
touchCurrentX = touchStartX;
126129
isSwiping = false;
130+
isScrolling = false;
127131
}, { passive: true });
128132

129133
panel.addEventListener('touchmove', (e) => {
130134
touchCurrentX = e.touches[0].clientX;
131135
const dx = touchStartX - touchCurrentX;
132136
if (!isSwiping) {
133-
if (Math.abs(dx) < 10) return;
137+
if (isScrolling) return;
138+
const dy = touchStartY - e.touches[0].clientY;
139+
const absDx = Math.abs(dx);
140+
const absDy = Math.abs(dy);
141+
if (absDx < 10 && absDy < 10) return;
142+
// Lock to scroll if vertical movement dominates
143+
if (absDy > absDx) {
144+
isScrolling = true;
145+
return;
146+
}
134147
isSwiping = true;
135148
if (!isOpen) $slideoutOverlay.show();
136149
$('html').addClass('slideout-open');

0 commit comments

Comments
 (0)